From: Alice Chao Date: Thu, 23 Jun 2022 03:50:52 +0000 (+0800) Subject: scsi: ufs: ufs-mediatek: Fix invalid access to vccqx X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=df1ea242e3d702342fd0c7c1a7b9ed6838645a05;p=linux.git scsi: ufs: ufs-mediatek: Fix invalid access to vccqx NULL pointer access issue was found for the regulator released by ufs_mtk_vreg_fix_vccq(). Simply fix this issue by clearing the released vreg pointer in ufs_hba struct. Link: https://lore.kernel.org/r/20220623035052.18802-9-stanley.chu@mediatek.com Reviewed-by: Stanley Chu Reviewed-by: Bart Van Assche Signed-off-by: Alice Chao Signed-off-by: Stanley Chu Signed-off-by: Martin K. Petersen --- diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index f81a7444f8a68..c958279bdd8fb 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -758,6 +758,7 @@ static void ufs_mtk_vreg_fix_vccqx(struct ufs_hba *hba) regulator_disable((*vreg_off)->reg); devm_kfree(hba->dev, (*vreg_off)->name); devm_kfree(hba->dev, *vreg_off); + *vreg_off = NULL; } }