提交 4a8842de 编写于 作者: T Tomas Henzl 提交者: Martin K. Petersen

scsi: mpt3sas: fix an out of bound write

cpu_msix_table is allocated to store online cpus, but pci_irq_get_affinity
may return cpu_possible_mask which is then used to access cpu_msix_table.
That causes bad user experience.  Fix limits access to only online cpus,
I've also added an additional test to protect from an unlikely change in
cpu_online_mask.

[mkp: checkpatch]

Fixes: 1d55abc0 ("scsi: mpt3sas: switch to pci_alloc_irq_vectors")
Signed-off-by: NTomas Henzl <thenzl@redhat.com>
Acked-by: NSuganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 a2390348
...@@ -2410,8 +2410,11 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc) ...@@ -2410,8 +2410,11 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc)
continue; continue;
} }
for_each_cpu(cpu, mask) for_each_cpu_and(cpu, mask, cpu_online_mask) {
if (cpu >= ioc->cpu_msix_table_sz)
break;
ioc->cpu_msix_table[cpu] = reply_q->msix_index; ioc->cpu_msix_table[cpu] = reply_q->msix_index;
}
} }
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册