From: sashiko-bot@kernel.org
To: "Peng Fan" <peng.fan@linux.dev>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v2 3/8] irqchip/imx-intmux: Fix probe error path
Date: Thu, 03 Dec 2026 09:50:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-247503@kernel.org> (raw)
In-Reply-To: <20261203-imx-intmux-v2-3-a6db1eed3b5f@nxp.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] irqchip/imx-intmux: lazy disable_irq() race in
imx_intmux_probe() rollback
- [Low] irqchip/imx-intmux: missing CHANIER clear in imx_intmux_probe()
rollback
--
commit 149da065195934513e17f562f9dd9bf36e9b88d8
Author: Peng Fan <peng.fan@nxp.com>
irqchip/imx-intmux: Fix probe error path
This commit unwinds initialized channels, tears down runtime PM, and
reorders clock enablement with runtime PM setup on the imx_intmux_probe()
error path.
> diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c
> index 3b4eb9bd6678b..06cf75a93373b 100644
> --- a/drivers/irqchip/irq-imx-intmux.c
> +++ b/drivers/irqchip/irq-imx-intmux.c
[ ... ]
> @@ -279,6 +285,24 @@ static int imx_intmux_probe(struct platform_device *pdev)
>
> return 0;
> out:
> + while (i--) {
> + /*
> + * Mask the parent interrupt and wait for a handler that is
> + * already running to finish before its data and mappings are
> + * torn down.
> + */
> + disable_irq(data->irqchip_data[i].irq);
> + irq_set_chained_handler_and_data(data->irqchip_data[i].irq,
> + NULL, NULL);
[Severity: Medium]
Can disable_irq() leave the parent GICv3 SPI unmasked here and allow
imx_intmux_irq_handler() to race with the rollback?
Neither gic_chip nor gic_eoimode1_chip implements .irq_disable, and
IRQ_DISABLE_UNLAZY is not set on the parent SPI. disable_irq() ->
__irq_disable(desc, false) therefore does a lazy disable and leaves the
interrupt unmasked in hardware when synchronize_irq() returns.
Because imx_intmux_irq_handler() is a chained handler, it does not check
irqd_irq_disabled() or set IRQD_IRQ_INPROGRESS.
irq_set_chained_handler_and_data() then clears handler_data before
__irq_do_set_handler() masks the IRQ, with no synchronize_irq() after:
CPU0 CPU1
imx_intmux_probe()
disable_irq(irq)
__irq_disable(desc, false)
/* GICv3 SPI stays unmasked */
synchronize_irq(irq)
irq_set_chained_handler_and_data()
handler_data = NULL
imx_intmux_irq_handler()
d = irq_desc_get_handler_data(desc)
d->chanidx <-- NULL dereference
__irq_do_set_handler()
mask_ack_irq(desc)
If imx_intmux_irq_handler() reads handler_data just before it is cleared,
it can also keep running unsynchronized while the rollback removes the
domain, disables data->ipg_clk, and devres frees intmux_data, causing a
use-after-free or unclocked MMIO access.
Setting IRQ_DISABLE_UNLAZY before disable_irq(), or calling
irq_set_chained_handler(irq, NULL) followed by synchronize_irq(irq) before
clearing handler_data, would ensure the parent line is masked and drained
first.
> + for (unsigned int hwirq = 0; hwirq < 32; hwirq++)
> + irq_dispose_mapping(irq_find_mapping(data->irqchip_data[i].domain,
> + hwirq));
> + irq_domain_remove(data->irqchip_data[i].domain);
> + irq_dispose_mapping(data->irqchip_data[i].irq);
> + }
[Severity: Low]
Should this rollback loop also clear CHANIER(i) before tearing down each
channel, as imx_intmux_remove() does?
Because irq_domain_create_linear() publishes each channel domain before
later channels are set up, a concurrently probing consumer can map and
unmask a child IRQ on an earlier channel before a later channel fails.
irq_dispose_mapping() -> irq_domain_disassociate() installs no_irq_chip
before masking, so imx_intmux_irq_mask() is not called and those
CHANIER(i) enable bits stay set during rollback and after probe fails.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-imx-intmux-v2-0-a6db1eed3b5f@nxp.com?part=3
next prev parent reply other threads:[~2026-12-03 9:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 9:29 [PATCH v2 0/8] irqchip/imx-intmux: Fix and modernize resource management Peng Fan
2026-12-03 9:29 ` [PATCH v2 1/8] irqchip/imx-intmux: Don't create parent mappings while counting channels Peng Fan
2026-12-03 9:52 ` sashiko-bot
2026-12-03 9:29 ` [PATCH v2 2/8] irqchip/imx-intmux: Dispose IRQ mappings on remove Peng Fan
2026-12-03 9:29 ` [PATCH v2 3/8] irqchip/imx-intmux: Fix probe error path Peng Fan
2026-12-03 9:50 ` sashiko-bot [this message]
2026-12-03 9:29 ` [PATCH v2 4/8] irqchip/imx-intmux: Reject zero channel count Peng Fan
2026-12-03 9:29 ` [PATCH v2 5/8] irqchip/imx-intmux: Mark input interrupts as level-triggered Peng Fan
2026-12-03 9:40 ` sashiko-bot
2026-12-03 9:29 ` [PATCH v2 6/8] irqchip/imx-intmux: Don't WARN on malformed interrupt specifiers Peng Fan
2026-12-03 9:46 ` sashiko-bot
2026-12-03 9:29 ` [PATCH v2 7/8] irqchip/imx-intmux: Use devm_irq_domain_create_linear() Peng Fan
2026-12-03 9:29 ` [PATCH v2 8/8] irqchip/imx-intmux: Factor out imx_intmux_teardown_channel() Peng Fan
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-247503@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=peng.fan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox