[lkml]   [2019]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3.16 017/136] USB: serial: keyspan: fix NULL-derefs on open() and write()
3.16.80-rc1 review patch.  If anyone has any objections, please let me know.


From: Johan Hovold <>

commit 7d7e21fafdbc7fcf0854b877bd0975b487ed2717 upstream.

Fix NULL-pointer dereferences on open() and write() which can be
triggered by a malicious USB device.

The current URB allocation helper would fail to initialise the newly
allocated URB if the device has unexpected endpoint descriptors,
something which could lead NULL-pointer dereferences in a number of
open() and write() paths when accessing the URB. For example:

BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:usb_clear_halt+0x11/0xc0
Call Trace:
? tty_port_open+0x4d/0xd0
keyspan_open+0x70/0x160 [keyspan]
serial_port_activate+0x5b/0x80 [usbserial]
? check_tty_count+0x43/0xa0

BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:keyspan_write+0x14e/0x1f3 [keyspan]
Call Trace:
serial_write+0x43/0xa0 [usbserial]
? do_wait_intr_irq+0x80/0x80
? process_echoes+0x60/0x60

BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:keyspan_usa26_send_setup+0x298/0x305 [keyspan]
Call Trace:
keyspan_open+0x10f/0x160 [keyspan]
serial_port_activate+0x5b/0x80 [usbserial]
? check_tty_count+0x43/0xa0

Fixes: fdcba53e2d58 ("fix for bugzilla #7544 (keyspan USB-to-serial converter)")
Reviewed-by: Greg Kroah-Hartman <>
Signed-off-by: Johan Hovold <>
Signed-off-by: Ben Hutchings <>
drivers/usb/serial/keyspan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1249,8 +1249,8 @@ static struct urb *keyspan_setup_urb(str

ep_desc = find_ep(serial, endpoint);
if (!ep_desc) {
- /* leak the urb, something's wrong and the callers don't care */
- return urb;
+ usb_free_urb(urb);
+ return NULL;
if (usb_endpoint_xfer_int(ep_desc)) {
ep_type_name = "INT";
 \ /
  Last update: 2019-12-17 01:57    [W:0.261 / U:3.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site