This series fixes two related IRQ-handling bugs in the PLDA PCIe
driver, both originally found by automated review from sashiko-bot
during work on an earlier, unrelated patch.
Patch 1 fixes a use-after-free: plda_pcie_irq_domain_deinit() removed
pcie->event_domain while devm-managed event IRQs requested from that
domain still had their free_irq() deferred by devres, so the deferred
cleanup could dereference an already-freed domain. It also hardens
the function so it is safe to call from partially-initialized state
(guards IRQ fields against being 0, and disposes of IRQ mappings
before their domains are torn down).
Patch 2 fixes resource leaks in plda_init_interrupts(): several error
paths returned directly without unwinding IRQ mappings or domains
already created earlier in the function. It adds shared error-handling
labels that call plda_pcie_irq_domain_deinit(), relying on the mapping
disposal added in patch 1.
Patch 2 depends on patch 1 and should not be applied on its own.
Both patches were build-tested and boot-tested on a StarFive
VisionFive v1.2A board.
Changes in v3:
- See individual patches for per-patch changes.
Ali Tariq (2):
PCI: plda: Fix use-after-free of event IRQs during teardown
PCI: plda: Fix resource leaks on error paths in plda_init_interrupts()
drivers/pci/controller/plda/pcie-plda-host.c | 52 ++++++++++++++++----
1 file changed, 42 insertions(+), 10 deletions(-)
--
2.34.1