PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure
Subsystems (4)
PATCH 1/1 PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure
The aspeed_pcie_probe() function calls aspeed_pcie_init_irq_domain() which allocates pcie->intx_domain and initializes MSI. However, if platform_get_irq() fails afterwards, the cleanup action was not yet registered via devm_add_action_or_reset(), causing the IRQ domain resources to leak.
Fix this by registering the devm cleanup action immediately after aspeed_pcie_init_irq_domain() succeeds, before calling platform_get_irq(). This ensures proper cleanup on any subsequent failure.
--- drivers/pci/controller/pcie-aspeed.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/controller/pcie-aspeed.c +4 -4
@@ -1052,14 +1052,14 @@ static int aspeed_pcie_probe(struct platform_device *pdev)if (ret)return ret; - irq =platform_get_irq (pdev,0 ); -if (irq <0 ) -return irq; - ret =devm_add_action_or_reset (dev, aspeed_pcie_irq_domain_free, pcie);if (ret)return ret; + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; + ret =devm_request_irq (dev, irq, aspeed_pcie_intr_handler,IRQF_SHARED ,dev_name (dev), pcie);if (ret)
---
base-commit: 785f0eb2f85decbe7c1ef9ae922931f0194ffc2e
change-id: 20260324-aspeed-b05454961d75
Best regards,
Signature · 1 line
Felix Gu <[email protected]>
Jacky Chou
maintainerPATCH 1/1 PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure
Hi Felix,
Thank you for your patch to help identify this issue.
Quoted 40 lines
The
aspeed_pcie_probe()function callsaspeed_pcie_init_irq_domain()which allocatespcie->intx_domainand initializes MSI. However, ifplatform_get_irq()fails afterwards, the cleanup action was not yet registered viadevm_add_action_or_reset(), causing the IRQ domain resources to leak.Fix this by registering the devm cleanup action immediately after
aspeed_pcie_init_irq_domain()succeeds, before callingplatform_get_irq(). This ensures proper cleanup on any subsequent failure.Fixes 9aa0cb68fcc1 ("PCI: aspeed: Add ASPEED PCIe RC driver")Signed-off-by Felix Gu <[email protected]>--- drivers/pci/controller/pcie-aspeed.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/pci/controller/pcie-aspeed.c +4
-4@@ -1052,14 +1052,14 @@ static int aspeed_pcie_probe(struct platform_device *pdev)if (ret)return ret; - irq =platform_get_irq (pdev,0 ); -if (irq <0 ) -return irq; - ret =devm_add_action_or_reset (dev, aspeed_pcie_irq_domain_free, pcie);if (ret)return ret; + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; + ret = devm_request_irq(dev, irq, aspeed_pcie_intr_handler,
IRQF_SHARED,
drivers/pci/controller/pcie-aspeed.c static int aspeed_pcie_probe(struct platform_device *pdev) · line 1065
Quoted 2 lines
drivers/pci/controller/pcie-aspeed.c +0
-0dev_name(dev), pcie);if (ret)
I have verified your patch on our platforms, AST2600 and AST2700, and it fixes this issue.
Thanks,
Jacky
Manivannan Sadhasivam
AppliedQuoted 6 lines · Felix Gu
The
aspeed_pcie_probe()function callsaspeed_pcie_init_irq_domain()which allocatespcie->intx_domainand initializes MSI. However, ifplatform_get_irq()fails afterwards, the cleanup action was not yet registered viadevm_add_action_or_reset(), causing the IRQ domain resources to leak.
Quoted 6 lines
Fix this by registering the devm cleanup action immediately after
aspeed_pcie_init_irq_domain()succeeds, before callingplatform_get_irq(). This ensures proper cleanup on any subsequent failure.[...]
Applied, thanks!
[1/1] PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure
commit: c54d5f5b33990f2649c20f35407f340bcadb8a53
Best regards,
Signature · 1 line
Manivannan Sadhasivam <[email protected]>