Re: [PATCH 2/3] PCI: altera: fix resource leaks on probe failure
From: Dinh Nguyen
Date: Fri Apr 24 2026 - 08:43:18 EST
Hi Mahesh,
On 4/24/26 04:49, Mahesh Vaidya wrote:
The chained IRQ handler is installed in altera_pcie_parse_dt() butI think you should decouple this patch from this series.
never unregistered on probe failure. If any subsequent step in
altera_pcie_probe() fails, devm frees the pcie struct while the
handler still references it. A subsequent interrupt would trigger
a use-after-free.
The INTx IRQ domain created in altera_pcie_init_irq_domain() is
similarly leaked on probe failure, since the existing cleanup via
altera_pcie_irq_teardown() is only invoked from the remove path.
Move the handler installation from altera_pcie_parse_dt() into
altera_pcie_probe() after the IRQ domain is created, and add a
goto-based error path so altera_pcie_irq_teardown() is called on
any failure after handler installation.
Fixes: 60f2ee5f1472 ("PCI: altera: Add Agilex support")
Signed-off-by: Mahesh Vaidya <mahesh.vaidya@xxxxxxxxxx>
---
drivers/pci/controller/pcie-altera.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Dinh