* [PATCH 1/3] irqchip/ls-extirq: Remove the interrupt domain on unbind
2026-11-28 9:41 [PATCH 0/3] irqchip: Remove interrupt domains on driver teardown Guangshuo Li
@ 2026-11-28 9:41 ` Guangshuo Li
2026-11-28 9:41 ` [PATCH 2/3] irqchip/ti-sci-intr: " Guangshuo Li
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-11-28 9:41 UTC (permalink / raw)
To: tglx, nm, kristo, ssantosh, hayashi.kunihiko, mhiramat,
ioana.ciornei, alexander.stein, maz, lokeshvutla,
yamada.masahiro, robh
Cc: radu, linux-kernel, linux-arm-kernel
The IRQ domain remains registered when the platform device releases
the controller data used by its domain operations. Remove the
domain as part of device teardown.
This issue was found by our static analysis tool under development.
Fixes: 05cd654829dd ("irqchip/ls-extirq: Convert to a platform driver to make it work again")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/irqchip/irq-ls-extirq.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-ls-extirq.c b/drivers/irqchip/irq-ls-extirq.c
index b791cb03a44a..ae8e9c918ac8 100644
--- a/drivers/irqchip/irq-ls-extirq.c
+++ b/drivers/irqchip/irq-ls-extirq.c
@@ -168,6 +168,11 @@ ls_extirq_parse_map(struct ls_extirq_data *priv, struct device_node *node)
return 0;
}
+static void ls_extirq_remove_domain(void *data)
+{
+ irq_domain_remove(data);
+}
+
static int ls_extirq_probe(struct platform_device *pdev)
{
struct irq_domain *domain, *parent_domain;
@@ -209,7 +214,7 @@ static int ls_extirq_probe(struct platform_device *pdev)
if (!domain)
return dev_err_probe(dev, -ENOMEM, "Failed to add IRQ domain\n");
- return 0;
+ return devm_add_action_or_reset(dev, ls_extirq_remove_domain, domain);
}
static const struct of_device_id ls_extirq_dt_ids[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/3] irqchip/ti-sci-intr: Remove the interrupt domain on unbind
2026-11-28 9:41 [PATCH 0/3] irqchip: Remove interrupt domains on driver teardown Guangshuo Li
2026-11-28 9:41 ` [PATCH 1/3] irqchip/ls-extirq: Remove the interrupt domain on unbind Guangshuo Li
@ 2026-11-28 9:41 ` Guangshuo Li
2026-11-28 9:41 ` [PATCH 3/3] irqchip/uniphier-aidet: " Guangshuo Li
2026-11-28 21:36 ` [PATCH 0/3] irqchip: Remove interrupt domains on driver teardown Radu Rendec
3 siblings, 0 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-11-28 9:41 UTC (permalink / raw)
To: tglx, nm, kristo, ssantosh, hayashi.kunihiko, mhiramat,
ioana.ciornei, alexander.stein, maz, lokeshvutla,
yamada.masahiro, robh
Cc: radu, linux-kernel, linux-arm-kernel
The IRQ domain remains registered when the platform device releases
the controller data used by its domain operations. Remove the
domain as part of device teardown.
This issue was found by our static analysis tool under development.
Fixes: cd844b0715ce ("irqchip/ti-sci-intr: Add support for Interrupt Router driver")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/irqchip/irq-ti-sci-intr.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-ti-sci-intr.c b/drivers/irqchip/irq-ti-sci-intr.c
index 1d2e5af3ac4f..d504bb8865b3 100644
--- a/drivers/irqchip/irq-ti-sci-intr.c
+++ b/drivers/irqchip/irq-ti-sci-intr.c
@@ -242,6 +242,11 @@ static const struct irq_domain_ops ti_sci_intr_irq_domain_ops = {
.translate = ti_sci_intr_irq_domain_translate,
};
+static void ti_sci_intr_remove_domain(void *data)
+{
+ irq_domain_remove(data);
+}
+
static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
{
struct irq_domain *parent_domain, *domain;
@@ -301,7 +306,7 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
dev_info(dev, "Interrupt Router %d domain created\n", intr->ti_sci_id);
- return 0;
+ return devm_add_action_or_reset(dev, ti_sci_intr_remove_domain, domain);
}
static const struct of_device_id ti_sci_intr_irq_domain_of_match[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 3/3] irqchip/uniphier-aidet: Remove the interrupt domain on unbind
2026-11-28 9:41 [PATCH 0/3] irqchip: Remove interrupt domains on driver teardown Guangshuo Li
2026-11-28 9:41 ` [PATCH 1/3] irqchip/ls-extirq: Remove the interrupt domain on unbind Guangshuo Li
2026-11-28 9:41 ` [PATCH 2/3] irqchip/ti-sci-intr: " Guangshuo Li
@ 2026-11-28 9:41 ` Guangshuo Li
2026-11-28 21:36 ` [PATCH 0/3] irqchip: Remove interrupt domains on driver teardown Radu Rendec
3 siblings, 0 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-11-28 9:41 UTC (permalink / raw)
To: tglx, nm, kristo, ssantosh, hayashi.kunihiko, mhiramat,
ioana.ciornei, alexander.stein, maz, lokeshvutla,
yamada.masahiro, robh
Cc: radu, linux-kernel, linux-arm-kernel
The interrupt domain remains registered after device removal frees
its controller data. Remove it before devres releases the register
mapping and private structure.
This issue was found by our static analysis tool under development.
Fixes: 5ed34d3a4387 ("irqchip: Add UniPhier AIDET irqchip driver")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/irqchip/irq-uniphier-aidet.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/irqchip/irq-uniphier-aidet.c b/drivers/irqchip/irq-uniphier-aidet.c
index dca3c6003539..a6cfe75c1989 100644
--- a/drivers/irqchip/irq-uniphier-aidet.c
+++ b/drivers/irqchip/irq-uniphier-aidet.c
@@ -198,6 +198,13 @@ static int uniphier_aidet_probe(struct platform_device *pdev)
return 0;
}
+static void uniphier_aidet_remove(struct platform_device *pdev)
+{
+ struct uniphier_aidet_priv *priv = platform_get_drvdata(pdev);
+
+ irq_domain_remove(priv->domain);
+}
+
static int __maybe_unused uniphier_aidet_suspend(struct device *dev)
{
struct uniphier_aidet_priv *priv = dev_get_drvdata(dev);
@@ -242,6 +249,7 @@ static const struct of_device_id uniphier_aidet_match[] = {
static struct platform_driver uniphier_aidet_driver = {
.probe = uniphier_aidet_probe,
+ .remove = uniphier_aidet_remove,
.driver = {
.name = "uniphier-aidet",
.of_match_table = uniphier_aidet_match,
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] irqchip: Remove interrupt domains on driver teardown
2026-11-28 9:41 [PATCH 0/3] irqchip: Remove interrupt domains on driver teardown Guangshuo Li
` (2 preceding siblings ...)
2026-11-28 9:41 ` [PATCH 3/3] irqchip/uniphier-aidet: " Guangshuo Li
@ 2026-11-28 21:36 ` Radu Rendec
3 siblings, 0 replies; 5+ messages in thread
From: Radu Rendec @ 2026-11-28 21:36 UTC (permalink / raw)
To: Guangshuo Li, tglx, nm, kristo, ssantosh, hayashi.kunihiko,
mhiramat, ioana.ciornei, alexander.stein, maz, lokeshvutla,
yamada.masahiro, robh
Cc: linux-kernel, linux-arm-kernel
On Sat, 2026-11-28 at 17:41 +0800, Guangshuo Li wrote:
> Pair domain creation with removal in the LS external interrupt, TI SCI
> interrupt and UniPhier AIDET drivers.
>
> Guangshuo Li (3):
> irqchip/ls-extirq: Remove the interrupt domain on unbind
> irqchip/ti-sci-intr: Remove the interrupt domain on unbind
> irqchip/uniphier-aidet: Remove the interrupt domain on unbind
>
> base-commit: 1aed0e209f0c3bb1f28d4d69c2fc23528d30981e
Thanks for the patches! I agree that they fix a real bug: leaking the
IRQ domain on the removal path - and it's true even for the drivers
that can be compiled only as built-in because (at least in theory) the
platform device can be explicitly unbound from the driver, even if the
driver itself cannot be removed from the kernel.
But I think the fix is incomplete and makes things worse in the
presence of downstream IRQ consumers. irq_domain_remove() makes *no*
checks for active mappings, and this is documented in the comment block
above the function. So it will remove the per-domain data associated
with mapped IRQs as well as the domain itself, while those IRQs are
active and can trigger at any time.
For irq-ls-extirq.c and irq-uniphier-aidet.c, I think the more
reasonable fix is to disable unbinding by setting .suppress_bind_attrs
to true in the driver structure. devm handling still makes sense for
the reset of the probe function, for rollback on the failure paths; but
the domain is created last and there's nothing else that can fail after
that, so there's no need to ever remove it at probe time.
For irq-ti-sci-intr.c, things are different because it's defined as
tristate in Kconfig, so it can be unloaded. I would do something
similar to what drivers/irqchip/irq-ts4800.c does in its remove
function: iterate through the mappings and explicitly remove them,
before calling irq_domain_remove().
That said, I think there are at least two other drivers that have
similar/related problems:
* drivers/irqchip/irq-ast2700-intc0.c has the same problem as this
series tries to fix: it calls irq_domain_create_hierarchy() but
there is no matching irq_domain_remove() for the unbind path.
* drivers/irqchip/irq-stm32mp-exti.c does exactly what you did, and
therefore has the problem I described above (for active mappings).
^ permalink raw reply [flat|nested] 5+ messages in thread