[tip: irq/drivers] irqchip/imx-irqsteer: Dispose of child IRQ mappings in remove()

From: tip-bot2 for Zhipeng Wang

Date: Mon Nov 09 2026 - 04:16:38 EST


The following commit has been merged into the irq/drivers branch of tip:

Commit-ID: d25b6b2dd79fdc0600a93905d3455c613859c43f
Gitweb: https://git.kernel.org/tip/d25b6b2dd79fdc0600a93905d3455c613859c43f
Author: Zhipeng Wang <zhipeng.wang_1@xxxxxxx>
AuthorDate: Wed, 04 Nov 2026 16:37:56 +09:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Mon, 09 Nov 2026 10:01:08 +01:00

irqchip/imx-irqsteer: Dispose of child IRQ mappings in remove()

Once the driver can be unloaded, the IRQ domain mappings handed out to
downstream consumers must be released on remove(), otherwise:

- a parent interrupt racing with the teardown can run the chained
handler while irqsteer_data is freed (no synchronize_irq());
- downstream irq_descs keep dangling chip pointers into the unloaded
module.

Dispose of every child hwirq mapping in remove(). irq_dispose_mapping()
calls irq_domain_disassociate(), which runs synchronize_irq() and frees
the descriptor, closing both races.

Signed-off-by: Zhipeng Wang <zhipeng.wang_1@xxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Reviewed-by: Radu Rendec <radu@xxxxxxxxxx>
Link: https://patch.msgid.link/20261104073759.386777-9-Zhipeng.wang_1@xxxxxxxxxxx
---
drivers/irqchip/irq-imx-irqsteer.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
index 9e8e660..ac26c9a 100644
--- a/drivers/irqchip/irq-imx-irqsteer.c
+++ b/drivers/irqchip/irq-imx-irqsteer.c
@@ -292,6 +292,9 @@ static void imx_irqsteer_remove(struct platform_device *pdev)
irq_dispose_mapping(irqsteer_data->irq[i]);
}

+ for (unsigned int hwirq = 0; hwirq < irqsteer_data->reg_num * 32; hwirq++)
+ irq_dispose_mapping(irq_find_mapping(irqsteer_data->domain, hwirq));
+
irq_domain_remove(irqsteer_data->domain);

if (ret >= 0)