Skip to content

Commit 8353da9

Browse files
jhovolddavem330
authored andcommitted
hso: fix NULL-deref on tty open
Fix NULL-pointer dereference on tty open due to a failure to handle a missing interrupt-in endpoint when probing modem ports: BUG: kernel NULL pointer dereference, address: 0000000000000006 ... RIP: 0010:tiocmget_submit_urb+0x1c/0xe0 [hso] ... Call Trace: hso_start_serial_device+0xdc/0x140 [hso] hso_serial_open+0x118/0x1b0 [hso] tty_open+0xf1/0x490 Fixes: 542f548 ("tty: Modem functions for the HSO driver") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 569aad4 commit 8353da9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/net/usb/hso.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,14 +2620,18 @@ static struct hso_device *hso_create_bulk_serial_device(
26202620
*/
26212621
if (serial->tiocmget) {
26222622
tiocmget = serial->tiocmget;
2623+
tiocmget->endp = hso_get_ep(interface,
2624+
USB_ENDPOINT_XFER_INT,
2625+
USB_DIR_IN);
2626+
if (!tiocmget->endp) {
2627+
dev_err(&interface->dev, "Failed to find INT IN ep\n");
2628+
goto exit;
2629+
}
2630+
26232631
tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
26242632
if (tiocmget->urb) {
26252633
mutex_init(&tiocmget->mutex);
26262634
init_waitqueue_head(&tiocmget->waitq);
2627-
tiocmget->endp = hso_get_ep(
2628-
interface,
2629-
USB_ENDPOINT_XFER_INT,
2630-
USB_DIR_IN);
26312635
} else
26322636
hso_free_tiomget(serial);
26332637
}

0 commit comments

Comments
 (0)