[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251119033301.518-1-vulab@iscas.ac.cn>
Date: Wed, 19 Nov 2025 11:33:01 +0800
From: Haotian Zhang <vulab@...as.ac.cn>
To: lpieralisi@...nel.org,
kwilczynski@...nel.org,
mani@...nel.org
Cc: robh@...nel.org,
bhelgaas@...gle.com,
michal.simek@....com,
linux-pci@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Haotian Zhang <vulab@...as.ac.cn>
Subject: [PATCH] PCI: xilinx: Fix INTx IRQ domain leak when MSI allocation fails
In xilinx_pcie_init_irq_domain(), if xilinx_allocate_msi_domains()
fails after pcie->leg_domain has been successfully created via
irq_domain_create_linear(), the function returns directly without
cleaning up the allocated IRQ domain, resulting in a resource leak.
Add irq_domain_remove() call in the error path to properly release the
IRQ domain before returning the error.
Fixes: 699ca3016268 ("PCI: xilinx: Check for __get_free_pages() failure")
Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
---
drivers/pci/controller/pcie-xilinx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c
index 937ea6ae1ac4..e8cf320f3764 100644
--- a/drivers/pci/controller/pcie-xilinx.c
+++ b/drivers/pci/controller/pcie-xilinx.c
@@ -480,8 +480,10 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie *pcie)
phys_addr_t pa = ALIGN_DOWN(virt_to_phys(pcie), SZ_4K);
ret = xilinx_allocate_msi_domains(pcie);
- if (ret)
+ if (ret) {
+ irq_domain_remove(pcie->leg_domain);
return ret;
+ }
pcie_write(pcie, upper_32_bits(pa), XILINX_PCIE_REG_MSIBASE1);
pcie_write(pcie, lower_32_bits(pa), XILINX_PCIE_REG_MSIBASE2);
--
2.50.1.windows.1
Powered by blists - more mailing lists