* [PATCH v2] USB: serial: sierra: validate URB length in instat callback
@ 2026-10-19 10:38 Tristan Madani
2026-10-19 10:40 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Tristan Madani @ 2026-10-19 10:38 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Kevin Lloyd, linux-usb, stable,
Tristan Madani
From: Tristan Madani <tristan@talencesecurity.com>
sierra_instat_callback() reads request fields and one byte past the
usb_ctrlrequest header without first checking that urb->actual_length
is large enough. A short USB interrupt transfer could cause an
out-of-bounds read.
Add two length checks matching the pattern already present in the
option driver (option_instat_callback): one for the request header
before accessing bRequestType, and one for the line-state data byte
inside the serial-state notification handler. Use dev_err() since
failing these checks causes the interrupt URB not to be resubmitted.
Fixes: 033a3fb980b041 ("USB: Sierra Wireless driver update")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
Changes in v2 (Johan Hovold):
- Split into two checks: one for the header before accessing
bRequestType, and one for the line-state data byte inside
the serial-state handler, matching the option driver pattern
- Use dev_err() instead of dev_dbg() since early return prevents
further interrupts
drivers/usb/serial/sierra.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 6e443aacae07d..03ed76dfbb2e3 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -575,10 +575,23 @@ static void sierra_instat_callback(struct urb *urb)
__func__);
return;
}
+ if (urb->actual_length < sizeof(*req_pkt)) {
+ dev_err(&port->dev, "%s: short transfer\n",
+ __func__);
+ return;
+ }
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(*req_pkt) + 1) {
+ dev_err(&port->dev,
+ "%s: short interrupt transfer\n",
+ __func__);
+ return;
+ }
+ signals = *((unsigned char *)
urb->transfer_buffer +
sizeof(struct usb_ctrlrequest));
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] USB: serial: sierra: validate URB length in instat callback
2026-10-19 10:38 [PATCH v2] USB: serial: sierra: validate URB length in instat callback Tristan Madani
@ 2026-10-19 10:40 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-19 10:40 UTC (permalink / raw)
To: Tristan Madani; +Cc: linux-usb
> From: Tristan Madani <tristan@talencesecurity.com>
>
> sierra_instat_callback() reads request fields and one byte past the
> usb_ctrlrequest header without first checking that urb->actual_length
> is large enough. A short USB interrupt transfer could cause an
> out-of-bounds read.
>
> Add two length checks matching the pattern already present in the
> option driver (option_instat_callback): one for the request header
> before accessing bRequestType, and one for the line-state data byte
> inside the serial-state notification handler. Use dev_err() since
> failing these checks causes the interrupt URB not to be resubmitted.
>
> Fixes: 033a3fb980b041 ("USB: Sierra Wireless driver update")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019103849.3716324-1-tristmd@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-19 10:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 10:38 [PATCH v2] USB: serial: sierra: validate URB length in instat callback Tristan Madani
2026-10-19 10:40 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.