From: sashiko-bot@kernel.org
To: "Marc Kleine-Budde" <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org,
"Oliver Hartkopp" <socketcan@hartkopp.net>,
"Vincent Mailhol" <mailhol@kernel.org>,
"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH net-next 4/9] can: gs_usb: gs_usb_receive_bulk_callback(): add missing call to can_rx_offload_irq_finish
Date: Tue, 01 Dec 2026 09:20:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-242955@kernel.org> (raw)
In-Reply-To: <20261130092003.1946901-5-mkl@pengutronix.de>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] can: gs_usb: use-after-free in
gs_usb_receive_bulk_callback() [1]
--
commit b6e91c21a113db9db4c7640d5fe163393fdf9284
Author: Marc Kleine-Budde <mkl@pengutronix.de>
can: gs_usb: gs_usb_receive_bulk_callback(): add missing call to can_rx_offload_irq_finish
This commit ensures can_rx_offload_irq_finish() is called in
gs_usb_receive_bulk_callback() when allocating an overflow error SKB fails,
so any SKB already queued to rx-offload is still processed before
resubmitting the URB.
Link: https://patch.msgid.link/20261130-gs_usb-fixes-v12-4-9ba1f84c179a@pengutronix.de
> diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
> index 6571ee0dd90f0..890389a1fa312 100644
> --- a/drivers/net/can/usb/gs_usb.c
> +++ b/drivers/net/can/usb/gs_usb.c
> @@ -742,7 +742,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
>
> skb = alloc_can_err_skb(netdev, &cf);
> if (!skb)
> - goto resubmit_urb;
> + goto can_rx_offload_irq_finish;
>
> cf->can_id |= CAN_ERR_CRTL;
> cf->len = CAN_ERR_DLC;
> @@ -751,6 +751,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
> gs_usb_rx_offload(dev, skb, hf);
> }
>
> +can_rx_offload_irq_finish:
> can_rx_offload_irq_finish(&dev->offload);
>
> resubmit_urb:
[Severity: Critical]
This problem wasn't introduced by this patch, but can a race between
gs_usb_receive_bulk_callback() and gs_usb_xmit_callback() cause a
use-after-free on echo_skb [1]?
CPU0 CPU1
gs_usb_receive_bulk_callback() gs_usb_xmit_callback()
skb = dev->can.echo_skb[hf->echo_id];
if (urb->status)
can_free_echo_skb(...)
gs_usb_get_echo_skb(dev, skb, hf)
gs_usb_set_timestamp(dev, skb, hf)
gs_usb_skb_set_timestamp(...) <-- use-after-free
When a TX URB completes with an error while an incoming echo frame with the
matching echo_id is processed concurrently, gs_usb_receive_bulk_callback()
can read dev->can.echo_skb[hf->echo_id] just before gs_usb_xmit_callback()
frees it via can_free_echo_skb(), and then pass the freed skb to
gs_usb_skb_set_timestamp().
[1] https://sashiko.dev/#/bug/linux-2052c20c-4b79-4ed7-851e-59c436d18021
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130092003.1946901-1-mkl@pengutronix.de?part=4
next prev parent reply other threads:[~2026-12-01 9:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 9:15 [PATCH net-next 0/9] pull-request: can-next 2026-11-30 Marc Kleine-Budde
2026-11-30 9:15 ` [PATCH net-next 1/9] can: gs_usb: gs_usb_probe(): init netdev completely before register_candev() Marc Kleine-Budde
2026-11-30 9:23 ` netdev-bot+sinfo
2026-11-30 20:34 ` Marc Kleine-Budde
2026-12-01 9:41 ` netdev-bot+sashiko
2026-11-30 9:15 ` [PATCH net-next 2/9] can: gs_usb: gs_usb_receive_bulk_callback(): update state even if SKB allocations fails Marc Kleine-Budde
2026-11-30 9:15 ` [PATCH net-next 3/9] can: gs_usb: gs_usb_receive_bulk_callback(): check for overflow flag if SKB allocation fails Marc Kleine-Budde
2026-11-30 9:15 ` [PATCH net-next 4/9] can: gs_usb: gs_usb_receive_bulk_callback(): add missing call to can_rx_offload_irq_finish Marc Kleine-Budde
2026-12-01 9:20 ` sashiko-bot [this message]
2026-11-30 9:15 ` [PATCH net-next 5/9] can: gs_usb: fix hardware timestamp state for mixed channels Marc Kleine-Budde
2026-11-30 9:15 ` [PATCH net-next 6/9] can: gs_usb: add support for context analysis Marc Kleine-Budde
2026-11-30 9:15 ` [PATCH net-next 7/9] can: gs_usb: gs_make_candev(): check can_rx_offload_add_manual() return value Marc Kleine-Budde
2026-11-30 9:15 ` [PATCH net-next 8/9] can: gs_usb: gs_usb_receive_bulk_callback(): use dev_info_ratelimited() to print re-submit info messages Marc Kleine-Budde
2026-12-01 9:41 ` netdev-bot+sashiko
2026-11-30 9:15 ` [PATCH net-next 9/9] can: gs_usb: gs_usb_receive_bulk_callback(): emit error message on invalid channel instead of disconnecting interfaces Marc Kleine-Budde
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-242955@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox