Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: xilinx: Fix INTx IRQ domain leak in error paths

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. In
xilinx_free_msi_domains(), pcie->leg_domain is also neglected.

Add irq_domain_remove() call in the error path to properly release the
IRQ domain before returning the error. Also rename
xilinx_free_msi_domains() to xilinx_free_irq_domains() and add the release
of pcie->leg_domain to it.

Fixes: 313b64c3ae52 ("PCI: xilinx: Convert to MSI domains")
Suggested-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20251219021615.965-1-vulab@iscas.ac.cn

authored by

Haotian Zhang and committed by
Manivannan Sadhasivam
f42b3c05 8f0b4cce

+6 -3
+6 -3
drivers/pci/controller/pcie-xilinx.c
··· 302 302 return 0; 303 303 } 304 304 305 - static void xilinx_free_msi_domains(struct xilinx_pcie *pcie) 305 + static void xilinx_free_irq_domains(struct xilinx_pcie *pcie) 306 306 { 307 307 irq_domain_remove(pcie->msi_domain); 308 + irq_domain_remove(pcie->leg_domain); 308 309 } 309 310 310 311 /* INTx Functions */ ··· 481 480 phys_addr_t pa = ALIGN_DOWN(virt_to_phys(pcie), SZ_4K); 482 481 483 482 ret = xilinx_allocate_msi_domains(pcie); 484 - if (ret) 483 + if (ret) { 484 + irq_domain_remove(pcie->leg_domain); 485 485 return ret; 486 + } 486 487 487 488 pcie_write(pcie, upper_32_bits(pa), XILINX_PCIE_REG_MSIBASE1); 488 489 pcie_write(pcie, lower_32_bits(pa), XILINX_PCIE_REG_MSIBASE2); ··· 603 600 604 601 err = pci_host_probe(bridge); 605 602 if (err) 606 - xilinx_free_msi_domains(pcie); 603 + xilinx_free_irq_domains(pcie); 607 604 608 605 return err; 609 606 }