Linux kernel -stable discussions
 help / color / mirror / Atom feed
* 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
       [not found] <20261130-gs_usb-fixes-v11-9-3f052bb620d4@pengutronix.de>
@ 2026-12-01 20:53 ` netdev-bot+sashiko
  0 siblings, 0 replies; only message in thread
From: netdev-bot+sashiko @ 2026-12-01 20:53 UTC (permalink / raw)
  To: mkl; +Cc: mailhol, pfink, eric, max, wg, kernel, linux-can, stable, kuba

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01 20:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261130-gs_usb-fixes-v11-9-3f052bb620d4@pengutronix.de>
2026-12-01 20:53 ` [PATCH can-next v11 9/9] can: gs_usb: gs_usb_receive_bulk_callback(): emit error message on invalid channel instead of disconnecting interfaces netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox