Files
rt-thread/components/drivers/pci
Bernard Xiong f6857f9fb0 [DM/PCI] Validate MSI-X table BIR and offset against BAR (#11986)
* [DM/PCI] Validate MSI-X table BIR and offset against BAR

BIR and the table offset in the MSI-X capability are controlled by the
device. msix_table_remap() used BIR directly as an index into
pdev->resource[] and never checked the table against the BAR size, so a
malicious device could make the kernel map and write to an arbitrary
physical address during probe.

Reject out-of-range BIR values, unassigned or zero-sized BARs, and
tables that do not fit completely inside the assigned BAR. Also verify
that the requested vector count does not exceed the table size read
from the MSI-X control register.

Fixes #11985

* [DM/PCI] Fix cppcheck warnings in MSI-X code

- Restore the default IRQ only when an MSI descriptor exists, avoiding
  a potential NULL pointer dereference in rt_pci_msi_shutdown
- Initialize the error code in msix_setup_msi_descs so that an empty
  vector list returns a defined value
2026-11-05 10:47:23 +08:00
..
2025-08-25 11:12:02 +08:00
…
…
…
…
…
2026-10-17 09:44:26 +08:00
2026-10-17 09:44:26 +08:00