[tip: irq/drivers] irqchip/renesas-irqc: Fix generic interrupt chip leak on remove
From: tip-bot2 for Qingshuang Fu
Date: Wed Jul 15 2026 - 03:15:41 EST
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: 616dd89d81ad9a3cf1cfff4088a4c43e4e00d6ba
Gitweb: https://git.kernel.org/tip/616dd89d81ad9a3cf1cfff4088a4c43e4e00d6ba
Author: Qingshuang Fu <fuqingshuang@xxxxxxxxxx>
AuthorDate: Wed, 08 Jul 2026 18:08:46 +08:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Wed, 15 Jul 2026 09:10:46 +02:00
irqchip/renesas-irqc: Fix generic interrupt chip leak on remove
The driver allocates domain generic chips probe. However, on driver
removal, the generic chips are not automatically freed when the interrupt
domain is removed because the domain flags do not include
IRQ_DOMAIN_FLAG_DESTROY_GC.
This causes both the domain generic chips structure and the associated
generic chips to be leaked. Additionally, the generic chips remain on the
global list and may later be accessed by generic interrupt chip suspend,
resume, or shutdown callbacks after the driver has been removed,
potentially resulting in a use-after-free and kernel crash.
Fix the resource leak by setting IRQ_DOMAIN_FLAG_DESTROY_GC on the
interrupt domain; this lets the interrupt domain core automatically
release all generic chips when irq_domain_remove() is invoked, removing
the need for manual cleanup calls in error paths and remove callback.
Fixes: 99c221df33fbfa1b ("irqchip/renesas-irqc: Move over to nested generic chip")
Signed-off-by: Qingshuang Fu <fuqingshuang@xxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20260708100846.506314-1-fffsqian@xxxxxxx
---
drivers/irqchip/irq-renesas-irqc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
index a20a647..1ff3535 100644
--- a/drivers/irqchip/irq-renesas-irqc.c
+++ b/drivers/irqchip/irq-renesas-irqc.c
@@ -176,6 +176,7 @@ static int irqc_probe(struct platform_device *pdev)
goto err_runtime_pm_disable;
}
+ p->irq_domain->flags |= IRQ_DOMAIN_FLAG_DESTROY_GC;
ret = irq_alloc_domain_generic_chips(p->irq_domain, p->number_of_irqs,
1, "irqc", handle_level_irq,
0, 0, IRQ_GC_INIT_NESTED_LOCK);