From: Ciprian Costea <ciprianmarian.costea@oss.nxp.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Vincent Mailhol <mailhol@kernel.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Cc: linux-can@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev, s32@nxp.com,
Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
Subject: [PATCH v4 0/3] can: rx-offload: make skb_irq_queue per-CPU
Date: Tue, 1 Sep 2026 13:48:45 +0200 [thread overview]
Message-ID: <20260901114848.500591-1-ciprianmarian.costea@oss.nxp.com> (raw)
From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
can_rx_offload keeps a lockless irq_queue that the IRQ handlers fill and
that is later spliced under skb_queue.lock into the NAPI-facing skb_queue.
This works as long as a single context fills the irq_queue. flexcan with
FLEXCAN_QUIRK_SECONDARY_MB_IRQ and mcf5441x use two mailbox IRQ lines. When
those are affined to different CPUs the two handlers can enqueue into the
same list at the same time and corrupt it.
This series:
1. Makes the irq_queue per-CPU so the handlers no longer share a list.
2. Fixes at91_can rx-offload teardown.
3. Checks the can_rx_offload_add_manual() return value in gs_usb.
Changes since v3:
- In gs_usb driver, check the can_rx_offload_add_manual() return value,
the same NULL-deref the per-CPU change exposes.
Changes since v2:
- at91_can: also add can_rx_offload_del() on the register_candev() error
path and check the can_rx_offload_add_timestamp() return value.
Changes since v1:
- The enqueue helpers used this_cpu_ptr() without disabling preemption.
All four enqueue helpers now use get_cpu_ptr()/put_cpu_ptr().
- Guard can_rx_offload_del() against skb_irq_queue == NULL.
- Fix 'at91_can' memory leak by adding missing 'can_rx_offload_del'.
Ciprian Marian Costea (3):
can: rx-offload: make skb_irq_queue per-CPU
can: at91_can: fix rx-offload cleanup on unbind and probe errors
can: gs_usb: check can_rx_offload_add_manual() return value
drivers/net/can/at91_can.c | 10 +++-
drivers/net/can/dev/rx-offload.c | 83 ++++++++++++++++++++++++++------
drivers/net/can/usb/gs_usb.c | 5 +-
include/linux/can/rx-offload.h | 2 +-
4 files changed, 82 insertions(+), 18 deletions(-)
--
2.43.0
next reply other threads:[~2026-09-01 11:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 11:48 Ciprian Costea [this message]
2026-09-01 11:48 ` [PATCH v4 1/3] can: rx-offload: make skb_irq_queue per-CPU Ciprian Costea
2026-09-01 11:48 ` [PATCH v4 2/3] can: at91_can: fix rx-offload cleanup on unbind and probe errors Ciprian Costea
2026-09-01 11:48 ` [PATCH v4 3/3] can: gs_usb: check can_rx_offload_add_manual() return value Ciprian Costea
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=20260901114848.500591-1-ciprianmarian.costea@oss.nxp.com \
--to=ciprianmarian.costea@oss.nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=dev.kurt@vandijck-laurijssen.be \
--cc=imx@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=nicolas.ferre@microchip.com \
--cc=s32@nxp.com \
/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