usb: serial: sierra: deal with insufficiently long notifications
Subsystems (2)
PATCH v2 1/1 usb: serial: sierra: deal with insufficiently long notifications
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.
---
v2:
- fixed description and added reporters and fixes tag
drivers/usb/serial/sierra.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/serial/sierra.c +11 -1
@@ -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 )
Signature · 1 line
2.55.0
Johan Hovold
maintainerQuoted 8 lines · Oliver Neukum
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 <[email protected]>Reported-by Lukas Dresel <[email protected]>
You should add a Link to the report(s) as well. I only saw the one from Jay.
Quoted 35 lines
Signed-off-by Oliver Neukum <[email protected]>---
v2:
- fixed description and added reporters and fixes tagdrivers/usb/serial/sierra.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)drivers/usb/serial/sierra.c +10
-1@@ -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 ));
drivers/usb/serial/sierra.c static void sierra_instat_callback(struct urb *urb) · line 615
Quoted 4 lines
drivers/usb/serial/sierra.c +1
-0@@ -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.
drivers/usb/serial/sierra.c static void sierra_instat_callback(struct urb *urb) · line 618
Quoted 3 lines
drivers/usb/serial/sierra.c +0
-0usb_mark_last_busy (serial->dev); err =usb_submit_urb (urb,GFP_ATOMIC );if (err && err != -EPERM )
Johan