Skip to content

Commit 765eb6e

Browse files
ISCAS-Vulabopsiff
authored andcommitted
PCI: mediatek: Fix IRQ domain leak when MSI allocation fails
[ Upstream commit 7f0cdcd ] In mtk_pcie_init_irq_domain(), if mtk_pcie_allocate_msi_domains() fails after port->irq_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 INTx IRQ domain before returning the error. Fixes: 43e6409 ("PCI: mediatek: Add MSI support for MT2712 and MT7622") Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://patch.msgid.link/20251119023308.476-1-vulab@iscas.ac.cn Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 24c190a5a24eed791a05ed60730f6cd1d348300d) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 09bd3f3 commit 765eb6e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/pci/controller/pcie-mediatek.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,10 @@ static int mtk_pcie_init_irq_domain(struct mtk_pcie_port *port,
580580

581581
if (IS_ENABLED(CONFIG_PCI_MSI)) {
582582
ret = mtk_pcie_allocate_msi_domains(port);
583-
if (ret)
583+
if (ret) {
584+
irq_domain_remove(port->irq_domain);
584585
return ret;
586+
}
585587
}
586588

587589
return 0;

0 commit comments

Comments
 (0)