Skip to content

Commit 2988a8a

Browse files
committed
USB: serial: ir-usb: add missing endpoint sanity check
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]>
1 parent 50c3c5e commit 2988a8a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/usb/serial/ir-usb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ static int ir_startup(struct usb_serial *serial)
195195
struct usb_irda_cs_descriptor *irda_desc;
196196
int rates;
197197

198+
if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1)
199+
return -ENODEV;
200+
198201
irda_desc = irda_usb_find_class_desc(serial, 0);
199202
if (!irda_desc) {
200203
dev_err(&serial->dev->dev,

0 commit comments

Comments
 (0)