Skip to content

Commit 5863638

Browse files
Alice Chaomartinkpetersen
authored andcommitted
scsi: ufs: host: mediatek: Fix invalid access in vccqx handling
Add a NULL check before accessing the 'vccqx' pointer to prevent invalid memory access. This ensures that the function safely handles cases where 'vccq' and 'vccq2' are not initialized, improving the robustness of the power management code. Signed-off-by: Alice Chao <alice.chao@mediatek.com> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Peter Wang <peter.wang@mediatek.com> Link: https://lore.kernel.org/r/20250811131423.3444014-11-peter.wang@mediatek.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 878ed88 commit 5863638

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/ufs/host/ufs-mediatek.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,9 @@ static void ufs_mtk_vccqx_set_lpm(struct ufs_hba *hba, bool lpm)
16291629
{
16301630
struct ufs_vreg *vccqx = NULL;
16311631

1632+
if (!hba->vreg_info.vccq && !hba->vreg_info.vccq2)
1633+
return;
1634+
16321635
if (hba->vreg_info.vccq)
16331636
vccqx = hba->vreg_info.vccq;
16341637
else

0 commit comments

Comments
 (0)