Commit 8c3aa49b authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: serial: ir-usb: add missing endpoint sanity check

commit 2988a8ae upstream.

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 f4a4cbb2 ("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: f4a4cbb2 ("USB: ir-usb: reimplement using generic framework")
Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8896e2ef
...@@ -195,6 +195,9 @@ static int ir_startup(struct usb_serial *serial) ...@@ -195,6 +195,9 @@ static int ir_startup(struct usb_serial *serial)
struct usb_irda_cs_descriptor *irda_desc; struct usb_irda_cs_descriptor *irda_desc;
int rates; int rates;
if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1)
return -ENODEV;
irda_desc = irda_usb_find_class_desc(serial, 0); irda_desc = irda_usb_find_class_desc(serial, 0);
if (!irda_desc) { if (!irda_desc) {
dev_err(&serial->dev->dev, dev_err(&serial->dev->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment