* [PATCH] PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure
@ 2026-03-23 17:57 Felix Gu
2026-03-24 12:22 ` Jacky Chou
2026-04-04 10:35 ` Manivannan Sadhasivam
0 siblings, 2 replies; 3+ messages in thread
From: Felix Gu @ 2026-03-23 17:57 UTC (permalink / raw)
To: Jacky Chou, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Joel Stanley,
Andrew Jeffery
Cc: linux-aspeed, linux-pci, linux-arm-kernel, linux-kernel, Felix Gu
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.
Fixes: 9aa0cb68fcc1 ("PCI: aspeed: Add ASPEED PCIe RC driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/pci/controller/pcie-aspeed.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/pcie-aspeed.c b/drivers/pci/controller/pcie-aspeed.c
index 3e1a39d1e648..6acfae7d026e 100644
--- a/drivers/pci/controller/pcie-aspeed.c
+++ b/drivers/pci/controller/pcie-aspeed.c
@@ -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,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure
2026-03-23 17:57 [PATCH] PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure Felix Gu
@ 2026-03-24 12:22 ` Jacky Chou
2026-04-04 10:35 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Jacky Chou @ 2026-03-24 12:22 UTC (permalink / raw)
To: Felix Gu, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Joel Stanley,
Andrew Jeffery
Cc: linux-aspeed@lists.ozlabs.org, linux-pci@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Hi Felix,
Thank you for your patch to help identify this issue.
> 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.
>
> Fixes: 9aa0cb68fcc1 ("PCI: aspeed: Add ASPEED PCIe RC driver")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> drivers/pci/controller/pcie-aspeed.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-aspeed.c
> b/drivers/pci/controller/pcie-aspeed.c
> index 3e1a39d1e648..6acfae7d026e 100644
> --- a/drivers/pci/controller/pcie-aspeed.c
> +++ b/drivers/pci/controller/pcie-aspeed.c
> @@ -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)
I have verified your patch on our platforms, AST2600 and AST2700, and it fixes this issue.
Tested-by: Jacky Chou <jacky_chou@aspeedtech.com>
Thanks,
Jacky
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure
2026-03-23 17:57 [PATCH] PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure Felix Gu
2026-03-24 12:22 ` Jacky Chou
@ 2026-04-04 10:35 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2026-04-04 10:35 UTC (permalink / raw)
To: Jacky Chou, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring, Bjorn Helgaas, Joel Stanley, Andrew Jeffery,
Felix Gu
Cc: linux-aspeed, linux-pci, linux-arm-kernel, linux-kernel
On Tue, 24 Mar 2026 01:57:59 +0800, Felix Gu wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure
commit: c54d5f5b33990f2649c20f35407f340bcadb8a53
Best regards,
--
Manivannan Sadhasivam <mani@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-04 10:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 17:57 [PATCH] PCI: aspeed: Fix IRQ domain leak on platform_get_irq() failure Felix Gu
2026-03-24 12:22 ` Jacky Chou
2026-04-04 10:35 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox