From: sashiko-bot@kernel.org
To: Zhipeng.wang_1@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v6 7/9] irqchip/imx-irqsteer: Allow building as module
Date: Thu, 08 Oct 2026 09:19:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-163920@kernel.org> (raw)
In-Reply-To: <20261008090231.796511-8-Zhipeng.wang_1@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] irqchip: imx-irqsteer module unload causes use-after-free
- [High] irqchip: imx-irqsteer UAF due to missing synchronize_irq() on remove
- [Medium] pm: CCF warning in devres teardown if pm_runtime_resume_and_get() fails
--
commit 47b4fb3a979bc15759a7bda151b9b79c2c92332a
Author: Jindong Yue <jindong.yue@nxp.com>
irqchip/imx-irqsteer: Allow building as module
Make the driver buildable as a module by turning the Kconfig symbol into
a tristate and using module_platform_driver() instead of
builtin_platform_driver(), and add the MODULE_DEVICE_TABLE() and module
metadata needed for autoloading.
> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> index 20b77fbc51ee0..105108d2e6ff7 100644
> --- a/drivers/irqchip/Kconfig
> +++ b/drivers/irqchip/Kconfig
> @@ -555,7 +555,7 @@ config CSKY_APB_INTC
> the controller's register.
>
> config IMX_IRQSTEER
> - bool "i.MX IRQSTEER support"
> + tristate "i.MX IRQSTEER support"
[Severity: High]
Does converting IMX_IRQSTEER to a tristate expose a use-after-free during
module unload?
The IRQ domain framework does not take a module reference on the irqchip
module. This means the module can be unloaded even while downstream
consumers hold active IRQ mappings in their irq_desc structures.
When unloaded, irq_domain_remove() emits a warning but proceeds to free
the domain. The irqchip module's .text and .rodata sections are then
freed, leaving the downstream irq_desc structures with dangling chip
pointers to the freed imx_irqsteer_irq_chip struct. A subsequent read of
/proc/interrupts will dereference the freed pointer.
> diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> index 15ee50f65d54c..85edd5e33ca9c 100644
> --- a/drivers/irqchip/irq-imx-irqsteer.c
> +++ b/drivers/irqchip/irq-imx-irqsteer.c
[ ... ]
> @@ -369,4 +371,7 @@ static struct platform_driver imx_irqsteer_driver = {
> .probe = imx_irqsteer_probe,
> .remove = imx_irqsteer_remove,
> };
> -builtin_platform_driver(imx_irqsteer_driver);
> +module_platform_driver(imx_irqsteer_driver);
[Severity: High]
Does enabling module unload via module_platform_driver() expose a
use-after-free in imx_irqsteer_remove() due to missing synchronization?
When the module is unloaded, imx_irqsteer_remove() clears the chained
handler:
for (i = 0; i < irqsteer_data->irq_count; i++) {
if (!irqsteer_data->irq[i])
break;
irq_set_chained_handler_and_data(irqsteer_data->irq[i],
NULL, NULL);
irq_dispose_mapping(irqsteer_data->irq[i]);
}
This teardown loop lacks a call to synchronize_irq(). If a parent
interrupt fires concurrently on another CPU just before the handler is
set to NULL, imx_irqsteer_irq_handler() will execute. Since there is no
synchronization, imx_irqsteer_remove() will return and trigger the
devres framework to free irqsteer_data while the handler is still
actively dereferencing it.
[Severity: Medium]
Will enabling module unload also trigger a clock underflow warning if
pm_runtime_resume_and_get() fails in imx_irqsteer_remove()?
During unload, imx_irqsteer_remove() calls:
ret = pm_runtime_resume_and_get(&pdev->dev);
And later:
if (ret >= 0)
pm_runtime_put_noidle(&pdev->dev);
If pm_runtime_resume_and_get() fails (for example, due to a hardware
timeout), the device remains suspended and the clock's enable_count
remains 0. The function ignores this failure and allows devres to
unconditionally call clk_disable_unprepare() on the clock. Calling
clk_disable() on a clock with an enable_count of 0 triggers a kernel
stack trace.
> +
> +MODULE_DESCRIPTION("i.MX IRQSTEER interrupt multiplexer/remapper driver");
> +MODULE_LICENSE("GPL");
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008090231.796511-1-Zhipeng.wang_1@oss.nxp.com?part=7
next prev parent reply other threads:[~2026-10-08 9:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 9:02 [PATCH v6 0/9] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-10-08 9:02 ` [PATCH v6 1/9] irqchip/imx-irqsteer: Call chained_irq_exit() on the handler error path Zhipeng.wang_1
2026-10-08 9:02 ` [PATCH v6 2/9] irqchip/imx-irqsteer: Validate IRQ count before creating domain Zhipeng.wang_1
2026-10-08 20:36 ` Frank Li
2026-10-08 9:02 ` [PATCH v6 3/9] irqchip/imx-irqsteer: Dispose of parent IRQ mappings in remove() Zhipeng.wang_1
2026-10-08 9:02 ` [PATCH v6 4/9] irqchip/imx-irqsteer: Convert to devm_pm_runtime_set_active_enabled() Zhipeng.wang_1
2026-10-08 9:21 ` sashiko-bot
2026-10-08 20:46 ` Frank Li
2026-10-10 8:38 ` Zhipeng Wang (OSS)
2026-10-08 20:41 ` Frank Li
2026-10-10 8:26 ` Zhipeng Wang (OSS)
2026-10-12 19:25 ` Frank Li
2026-10-08 9:02 ` [PATCH v6 5/9] irqchip/imx-irqsteer: Mask all interrupts in probe() Zhipeng.wang_1
2026-10-08 9:18 ` sashiko-bot
2026-10-08 20:59 ` Frank Li
2026-10-08 9:02 ` [PATCH v6 6/9] irqchip/imx-irqsteer: Let devres own the clock Zhipeng.wang_1
2026-10-08 9:13 ` sashiko-bot
2026-10-08 20:54 ` Frank Li
2026-10-08 9:02 ` [PATCH v6 7/9] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-10-08 9:19 ` sashiko-bot [this message]
2026-10-08 9:02 ` [PATCH v6 8/9] genirq/irqdomain: Add devm_irq_domain_create_linear() Zhipeng.wang_1
2026-10-08 9:02 ` [PATCH v6 9/9] irqchip/imx-irqsteer: Use devm_irq_domain_create_linear() Zhipeng.wang_1
2026-10-08 9:15 ` sashiko-bot
2026-10-08 21:01 ` Frank Li
2026-10-10 9:06 ` Zhipeng Wang (OSS)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-163920@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=Zhipeng.wang_1@oss.nxp.com \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.