From: netdev-bot+sashiko@kernel.org
To: mkl@pengutronix.de
Cc: mailhol@kernel.org, pfink@christ-es.de, eric@evenchick.com,
max@schneidersoft.net, wg@grandegger.com, kernel@pengutronix.de,
linux-can@vger.kernel.org, stable@vger.kernel.org,
kuba@kernel.org
Subject: Re: [PATCH can-next v11 9/9] can: gs_usb: gs_usb_receive_bulk_callback(): emit error message on invalid channel instead of disconnecting interfaces
Date: Tue, 01 Dec 2026 20:53:26 +0000 [thread overview]
Message-ID: <179615840643.3142.8725437906556473875@kernel.org> (raw)
In-Reply-To: <20261130-gs_usb-fixes-v11-9-3f052bb620d4@pengutronix.de>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In gs_usb_receive_bulk_callback() (drivers/net/can/usb/gs_usb.c),
this patch quietly undoes a deliberate, stable-tagged hardening…
--
can: gs_usb: gs_usb_receive_bulk_callback(): emit error message on invalid channel instead of disconnecting interfaces
This commit changes how gs_usb_receive_bulk_callback() handles a frame
whose channel number is out of range. The driver used to detach every
network interface of the USB device. It now logs a rate-limited error
and resubmits the URB.
> diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
> index 7cd34395f0529..e6632b5f87f58 100644
> --- a/drivers/net/can/usb/gs_usb.c
> +++ b/drivers/net/can/usb/gs_usb.c
> @@ -665,8 +665,13 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
> }
>
> /* device reports out of range channel id */
> - if (hf->channel >= parent->channel_cnt)
> - goto device_detach;
> + if (hf->channel >= parent->channel_cnt) {
> + dev_err_ratelimited(&parent->udev->dev,
> + "channel number out of range (channel=%u, channel_cnt=%u)\n",
> + hf->channel, parent->channel_cnt);
> +
> + goto resubmit_urb;
> + }
[Severity: Low]
This change reverses commit 4a8737ff0687 ("can: gs_usb: fix use of
uninitialized variable, detach device on reception of invalid USB data").
That commit was tagged for stable and deliberately switched this path from
goto resubmit_urb to goto device_detach. Its commit message says:
If the channel number is bigger than the actual number of
channels assume broken or malicious USB device and shut it down.
The commit message here calls the event a "firmware glitch" and says the
old code detached the interfaces "silently". It doesn't mention
4a8737ff0687, and it doesn't say why that earlier reasoning no longer
holds.
Could the commit message reference 4a8737ff0687 and explain the change in
policy? With this patch, a device that keeps sending invalid channel
numbers is no longer shut down. Its URBs are resubmitted indefinitely,
with only rate-limited logging.
Jumping to resubmit_urb without a valid dev or netdev looks safe in this
tree, because the resubmit block only touches parent fields:
resubmit_urb:
usb_fill_bulk_urb(urb, parent->udev,
parent->pipe_in,
hf, parent->hf_size_rx,
gs_usb_receive_bulk_callback, parent);
However, 4a8737ff0687 removed this same jump because, at that time, the
resubmit path dereferenced an uninitialized dev (dev->gs_hf_size). The
safety now depends on earlier refactors, including the preceding change
that switched the resubmit failure message to dev_info_ratelimited(). It
might be worth recording that dependency in the commit message. That way,
a backport to an older tree whose resubmit_urb still uses dev won't bring
back the uninitialized pointer use.
>
> dev = parent->canch[hf->channel];
>
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-gs_usb-fixes-v11-0-3f052bb620d4%40pengutronix.de
prev parent reply other threads:[~2026-12-01 20:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 7:37 [PATCH can-next v11 0/9] gs_usb: fixes - part 1 Marc Kleine-Budde
2026-11-30 7:37 ` [PATCH can-next v11 1/9] can: gs_usb: gs_usb_probe(): init netdev completely before register_candev() Marc Kleine-Budde
2026-11-30 7:37 ` [PATCH can-next v11 2/9] can: gs_usb: gs_usb_receive_bulk_callback(): update state even if SKB allocations fails Marc Kleine-Budde
2026-11-30 7:45 ` sashiko-bot
2026-11-30 8:04 ` Marc Kleine-Budde
2026-12-01 20:53 ` netdev-bot+sashiko
2026-12-01 20:56 ` Marc Kleine-Budde
2026-11-30 7:37 ` [PATCH can-next v11 3/9] can: gs_usb: gs_usb_receive_bulk_callback(): check for overflow flag if SKB allocation fails Marc Kleine-Budde
2026-11-30 7:37 ` [PATCH can-next v11 4/9] can: gs_usb: gs_usb_receive_bulk_callback(): add missing call to can_rx_offload_irq_finish Marc Kleine-Budde
2026-11-30 7:37 ` [PATCH can-next v11 5/9] can: gs_usb: fix hardware timestamp state for mixed channels Marc Kleine-Budde
2026-11-30 7:37 ` [PATCH can-next v11 6/9] can: gs_usb: add support for context analysis Marc Kleine-Budde
2026-11-30 7:44 ` sashiko-bot
2026-12-01 20:53 ` netdev-bot+sashiko
2026-11-30 7:37 ` [PATCH can-next v11 7/9] can: gs_usb: gs_make_candev(): check can_rx_offload_add_manual() return value Marc Kleine-Budde
2026-11-30 7:37 ` [PATCH can-next v11 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 20:53 ` netdev-bot+sashiko
2026-11-30 7:37 ` [PATCH can-next v11 9/9] can: gs_usb: gs_usb_receive_bulk_callback(): emit error message on invalid channel instead of disconnecting interfaces Marc Kleine-Budde
2026-12-01 20:53 ` netdev-bot+sashiko [this message]
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=179615840643.3142.8725437906556473875@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=eric@evenchick.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=max@schneidersoft.net \
--cc=mkl@pengutronix.de \
--cc=pfink@christ-es.de \
--cc=stable@vger.kernel.org \
--cc=wg@grandegger.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