Skip to content

Commit

Permalink
USB: serial: ir-usb: add missing endpoint sanity check
Browse files Browse the repository at this point in the history
Add missing endpoint sanity check to avoid dereferencing a NULL-pointer
on open() in case a device lacks a bulk-out endpoint.

Note that prior to commit f4a4cbb ("USB: ir-usb: reimplement using
generic framework") the oops would instead happen on open() if the
device lacked a bulk-in endpoint and on write() if it lacked a bulk-out
endpoint.

Fixes: f4a4cbb ("USB: ir-usb: reimplement using generic framework")
Fixes: 1da177e ("Linux-2.6.12-rc2")
Cc: stable <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
  • Loading branch information
jhovold committed Jan 23, 2020
1 parent 50c3c5e commit 2988a8a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/serial/ir-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ static int ir_startup(struct usb_serial *serial)
struct usb_irda_cs_descriptor *irda_desc;
int rates;

if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1)
return -ENODEV;

irda_desc = irda_usb_find_class_desc(serial, 0);
if (!irda_desc) {
dev_err(&serial->dev->dev,
Expand Down

0 comments on commit 2988a8a

Please sign in to comment.