Linux USB
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: gregkh@linuxfoundation.org, jkrshnmenon@gmail.com,
	linux-usb@vger.kernel.org, Lukas Dresel <lukas@artiphishell.com>
Subject: Re: [PATCHv2] usb: serial: sierra: deal with insufficiently long notifications
Date: Wed, 15 Jul 2026 11:13:36 +0200	[thread overview]
Message-ID: <aldPQHu1lPvxrTug@hovoldconsulting.com> (raw)
In-Reply-To: <20260715090821.1364583-1-oneukum@suse.com>

On Wed, Jul 15, 2026 at 11:04:32AM +0200, Oliver Neukum wrote:
> A malicious device can send too short messages which
> would cause the driver to read beyond the part of the buffer
> holding valid data.
> Ignore too short packets.
> 
> Fixes: 033a3fb980b04 ("USB: Sierra Wireless driver update")
> Reported-by: Jay Vadayath <jkrshnmenon@gmail.com>
> Reported-by: Lukas Dresel <lukas@artiphishell.com>

You should add a Link to the report(s) as well. I only saw the one from
Jay.

> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
> 
> v2:
> - fixed description and added reporters and fixes tag
> 
>  drivers/usb/serial/sierra.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
> index 6e443aacae07..f50833055360 100644
> --- a/drivers/usb/serial/sierra.c
> +++ b/drivers/usb/serial/sierra.c
> @@ -575,10 +575,19 @@ static void sierra_instat_callback(struct urb *urb)
>  				__func__);
>  			return;
>  		}
> +
> +		if (urb->actual_length < sizeof(struct usb_ctrlrequest))
> +			goto skip_too_short;
> +
>  		if ((req_pkt->bRequestType == 0xA1) &&
>  				(req_pkt->bRequest == 0x20)) {
>  			int old_dcd_state;
> -			unsigned char signals = *((unsigned char *)
> +			unsigned char signals;
> +
> +			if (urb->actual_length < sizeof(struct usb_ctrlrequest) + 1)
> +				goto skip_too_short;
> +
> +			signals = *((unsigned char *)
>  					urb->transfer_buffer +
>  					sizeof(struct usb_ctrlrequest));
>  
> @@ -603,6 +612,7 @@ static void sierra_instat_callback(struct urb *urb)
>  
>  	/* Resubmit urb so we continue receiving IRQ data */
>  	if (status != -ESHUTDOWN && status != -ENOENT) {
> +skip_too_short:

Please move and rename this one as I suggested in my reply to v1.

>  		usb_mark_last_busy(serial->dev);
>  		err = usb_submit_urb(urb, GFP_ATOMIC);
>  		if (err && err != -EPERM)

Johan

      reply	other threads:[~2026-07-15  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  9:04 [PATCHv2] usb: serial: sierra: deal with insufficiently long notifications Oliver Neukum
2026-07-15  9:13 ` Johan Hovold [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=aldPQHu1lPvxrTug@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jkrshnmenon@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@artiphishell.com \
    --cc=oneukum@suse.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