Commit 9c44811b authored by Johan Hovold's avatar Johan Hovold Committed by Ben Hutchings

USB: serial: cyberjack: fix NULL-deref at open

commit 3dca0111 upstream.

Fix NULL-pointer dereference when clearing halt at open should the device
lack a bulk-out endpoint.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at cyberjack_open+0x40/0x9c [cyberjack]

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
[bwh: Backported to 3.2: add this check to the existing
 usb_serial_driver::attach implementation]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 7fcebcb8
......@@ -122,6 +122,9 @@ static int cyberjack_startup(struct usb_serial *serial)
dbg("%s", __func__);
if (serial->num_bulk_out < serial->num_ports)
return -ENODEV;
/* allocate the private data structure */
priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL);
if (!priv)
......
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