]> git.ipfire.org Git - thirdparty/linux.git/commit
PCI: mediatek: Fix IRQ domain leak when port fails to enable
authorManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Thu, 21 May 2026 17:46:17 +0000 (23:16 +0530)
committerManivannan Sadhasivam <mani@kernel.org>
Tue, 9 Jun 2026 16:49:51 +0000 (22:19 +0530)
commitf865a57896bd92d7662eb2818d8f48872e2cbbc7
treea9bed3f0a59bc756f2caf58558cadeb8abef15ab
parent282305d7e9c0e27fd8b4df34b7cd5506a1eccdd6
PCI: mediatek: Fix IRQ domain leak when port fails to enable

When mtk_pcie_enable_port() fails, mtk_pcie_port_free() removes the port
from pcie->ports and frees the port structure. However, the IRQ domains set
up earlier by mtk_pcie_init_irq_domain() are never freed.

Fix this by refactoring mtk_pcie_irq_teardown() into a per-port helper,
mtk_pcie_irq_teardown_port(), and calling it from mtk_pcie_setup() when
mtk_pcie_enable_port() fails. Since the IRQ teardown must only happen in
the probe error path (during resume, child devices may have active MSI
mappings and the NOIRQ context prohibits sleeping locks),
mtk_pcie_enable_port() is changed to return an error code so callers can
distinguish the two paths and act accordingly.

This issue was reported by Sashiko while reviewing the EcoNet EN7528 SoC
support series.

Fixes: b099631df160 ("PCI: mediatek: Add controller support for MT2712 and MT7622")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Cc: stable@vger.kernel.org # 5.10
Cc: Caleb James DeLisle <cjd@cjdns.fr>
Link: https://patch.msgid.link/20260521174617.17692-1-mani@kernel.org
drivers/pci/controller/pcie-mediatek.c