From: sashiko-bot@kernel.org
To: "Ciprian Costea" <ciprianmarian.costea@oss.nxp.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
"Oliver Hartkopp" <socketcan@hartkopp.net>,
linux-can@vger.kernel.org, "Vincent Mailhol" <mailhol@kernel.org>,
imx@lists.linux.dev, Frank.Li@kernel.org,
"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH v7 1/6] can: flexcan: use dedicated IRQ handlers for multi-IRQ platforms
Date: Mon, 31 Aug 2026 18:01:31 +0000 [thread overview]
Message-ID: <20260831180131.B55E61F00ACA@smtp.kernel.org> (raw)
In-Reply-To: <20260831143449.12828-2-ciprianmarian.costea@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The split IRQ handlers fail to resolve multi-IRQ concurrency for device state processing, leading to lockless list corruption.
--
commit f3f261bafd25e44254ad99cda953074bc68ed987
Author: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
can: flexcan: use dedicated IRQ handlers for multi-IRQ platforms
This commit splits the monolithic flexcan_irq handler into dedicated
functions for mailbox, device state, and bus error processing. The split
handlers are then registered to specific multi-IRQ lines depending on the
platform quirks.
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index f5d22c61503fa..2e9df2d14b341 100644
> --- a/drivers/net/can/flexcan/flexcan-core.c
> +++ b/drivers/net/can/flexcan/flexcan-core.c
[ ... ]
> +/* Process device state change events */
> +static irqreturn_t flexcan_do_state(struct net_device *dev)
> +{
[ ... ]
> + /* state change interrupt or broken error state quirk fix is enabled */
> + if ((reg_esr & FLEXCAN_ESR_ERR_STATE) ||
> + (priv->devtype_data.quirks &
> + (FLEXCAN_QUIRK_BROKEN_WERR_STATE | FLEXCAN_QUIRK_BROKEN_PERR_STATE)))
> + flexcan_irq_state(dev, reg_esr);
[Severity: High]
This is a pre-existing issue, but does calling flexcan_irq_state()
concurrently corrupt the lockless SKB queue?
If the boff and err handlers execute flexcan_do_state() concurrently,
they will both allocate error SKBs and insert them into
offload->skb_irq_queue using the lockless __skb_queue_add_sort().
Can this concurrent insertion corrupt the list pointers (skb->next and
skb->prev), potentially causing infinite loops or use-after-free
conditions?
[ ... ]
> +/* Bus error IRQ handler for multi-IRQ platforms */
> +static irqreturn_t flexcan_irq_berr(int irq, void *dev_id)
> +{
> + struct net_device *dev = dev_id;
> + struct flexcan_priv *priv = netdev_priv(dev);
> + irqreturn_t handled;
> +
> + handled = flexcan_do_berr(dev);
> +
> + if (priv->devtype_data.quirks & FLEXCAN_QUIRK_BROKEN_PERR_STATE)
> + handled |= flexcan_do_state(dev);
[Severity: High]
This isn't a bug introduced by this patch, but could this multi-IRQ
setup lead to concurrent device state mutations?
On platforms like s32g2 and mcf5441x with FLEXCAN_QUIRK_NR_IRQ_3 and
FLEXCAN_QUIRK_BROKEN_PERR_STATE, a hardware bus error or state change
can trigger both the boff and berr interrupts on distinct IRQ lines.
Since flexcan_irq_berr() and flexcan_irq_boff() execute on different
CPUs, couldn't they both call flexcan_do_state(dev) at the same time?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831143449.12828-1-ciprianmarian.costea@oss.nxp.com?part=1
next prev parent reply other threads:[~2026-08-31 18:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 14:34 [PATCH v7 0/6] can: flexcan: Add NXP S32N79 SoC support Ciprian Costea
2026-08-31 14:34 ` [PATCH v7 1/6] can: flexcan: use dedicated IRQ handlers for multi-IRQ platforms Ciprian Costea
2026-08-31 18:01 ` sashiko-bot [this message]
2026-09-01 14:44 ` Ciprian Marian Costea
2026-08-31 14:34 ` [PATCH v7 2/6] can: flexcan: disable all IRQ lines in flexcan_chip_interrupts_enable() Ciprian Costea
2026-08-31 18:15 ` sashiko-bot
2026-08-31 14:34 ` [PATCH v7 3/6] can: flexcan: split rx/tx masks per mailbox IRQ line Ciprian Costea
2026-08-31 18:27 ` sashiko-bot
2026-08-31 14:34 ` [PATCH v7 4/6] dt-bindings: can: fsl,flexcan: add NXP S32N79 SoC support Ciprian Costea
2026-08-31 18:37 ` sashiko-bot
2026-08-31 14:34 ` [PATCH v7 5/6] can: flexcan: add FLEXCAN_QUIRK_IRQ_BERR quirk Ciprian Costea
2026-08-31 18:51 ` sashiko-bot
2026-08-31 14:34 ` [PATCH v7 6/6] can: flexcan: add NXP S32N79 SoC support Ciprian Costea
2026-08-31 19:01 ` sashiko-bot
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=20260831180131.B55E61F00ACA@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=ciprianmarian.costea@oss.nxp.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=socketcan@hartkopp.net \
/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.