From: Oliver Neukum <oneukum@suse.com>
To: gregkh@linuxfoundation.org, johan@kernel.org,
jkrshnmenon@gmail.com, linux-usb@vger.kernel.org
Cc: Oliver Neukum <oneukum@suse.com>
Subject: [PATCH] usb: serial: sierra: deal with insufficiently long notifications
Date: Tue, 14 Jul 2026 20:33:05 +0200 [thread overview]
Message-ID: <20260714183305.1331363-1-oneukum@suse.com> (raw)
A malicious device can send too short messages which
would cause the driver to overflow the buffer and hit
stale data in their interpretation.
Ignore too short packets.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
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:
usb_mark_last_busy(serial->dev);
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err && err != -EPERM)
--
2.55.0
next reply other threads:[~2026-07-14 18:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 18:33 Oliver Neukum [this message]
2026-07-15 7:22 ` [PATCH] usb: serial: sierra: deal with insufficiently long notifications Johan Hovold
2026-07-15 10:05 ` Oliver Neukum
2026-07-15 12:18 ` Johan Hovold
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=20260714183305.1331363-1-oneukum@suse.com \
--to=oneukum@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=jkrshnmenon@gmail.com \
--cc=johan@kernel.org \
--cc=linux-usb@vger.kernel.org \
/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