summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-01-03 16:40:03 +0100
committerJohan Hovold <johan@kernel.org>2017-01-04 10:43:57 +0100
commitef079936d3cd09e63612834fe2698eeada0d8e3f (patch)
tree71b4e7cdf62b6547f68b37b21c5f9e5775a74beb /drivers/usb
parentcc0909248258f679c4bb4cd315565d40abaf6bc6 (diff)
downloadop-kernel-dev-ef079936d3cd09e63612834fe2698eeada0d8e3f.zip
op-kernel-dev-ef079936d3cd09e63612834fe2698eeada0d8e3f.tar.gz
USB: serial: ti_usb_3410_5052: fix NULL-deref at open
Fix NULL-pointer dereference in open() should a malicious device lack the expected endpoints: Unable to handle kernel NULL pointer dereference at virtual address 00000030 .. [<bf06a6b0>] (ti_open [ti_usb_3410_5052]) from [<bf02e118>] (serial_port_activate+0x68/0x98 [usbserial]) Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable <stable@vger.kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 8db9d07..64b85b8 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -579,6 +579,13 @@ static int ti_startup(struct usb_serial *serial)
goto free_tdev;
}
+ if (serial->num_bulk_in < serial->num_ports ||
+ serial->num_bulk_out < serial->num_ports) {
+ dev_err(&serial->interface->dev, "missing endpoints\n");
+ status = -ENODEV;
+ goto free_tdev;
+ }
+
return 0;
free_tdev:
OpenPOWER on IntegriCloud