Skip to content

Commit 7ec2bd6

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: mediatek: Fix out-of-bounds access in MCQ IRQ mapping
Address a potential out-of-bounds access issue when accessing 'host->mcq_intr_info[q_index]'. The value of 'q_index' might exceed the valid array bounds if 'q_index == nr'. Correct condition to 'q_index >= nr' to prevent accessing invalid memory. Fixes: 66e26a4 ("scsi: ufs: host: mediatek: Set IRQ affinity policy for MCQ mode") Cc: [email protected] Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Peter Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent eea6caf commit 7ec2bd6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/ufs/host/ufs-mediatek.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ static u32 ufs_mtk_mcq_get_irq(struct ufs_hba *hba, unsigned int cpu)
818818
unsigned int q_index;
819819

820820
q_index = map->mq_map[cpu];
821-
if (q_index > nr) {
821+
if (q_index >= nr) {
822822
dev_err(hba->dev, "hwq index %d exceed %d\n",
823823
q_index, nr);
824824
return MTK_MCQ_INVALID_IRQ;

0 commit comments

Comments
 (0)