pci.c: assert MSIX table count <= config max
Assert that PCI devices discovered while booting the hypervisor do not have more table entries than allowed by the compile-time configuration (CONFIG_MAX_MSIX_TABLE_NUM). The case were `msix.table_count` > `CONFIG_MAX_MSIX_TABLE_NUM` is fatal since the init function in the handler for MSI-X (vmsix_init) only looks at `table_count` when populating the table. Since `CONFIG_MAX_MSIX_TABLE_NUM` is the max size of the table array entry in the pci_msix struct. This will cause the msix handler to write outside of the table array. Tracked-On: #2624 Signed-off-by: Viktor Sjölind <vsjolind@luxoft.com>
This commit is contained in:
parent
137892fdd5
commit
5f51e4a762
|
@ -352,6 +352,8 @@ static void pci_read_cap(struct pci_pdev *pdev)
|
|||
pdev->msix.table_offset = table_info & ~PCIM_MSIX_BIR_MASK;
|
||||
pdev->msix.table_count = (msgctrl & PCIM_MSIXCTRL_TABLE_SIZE) + 1U;
|
||||
|
||||
ASSERT(pdev->msix.table_count <= CONFIG_MAX_MSIX_TABLE_NUM);
|
||||
|
||||
/* Copy MSIX capability struct into buffer */
|
||||
for (idx = 0U; idx < len; idx++) {
|
||||
pdev->msix.cap[idx] = (uint8_t)pci_pdev_read_cfg(pdev->bdf, offset + idx, 1U);
|
||||
|
|
Loading…
Reference in New Issue