Skip to content

Commit 299d757

Browse files
committed
USB: serial: console: fix use-after-free after failed setup
Make sure to reset the USB-console port pointer when console setup fails in order to avoid having the struct usb_serial be prematurely freed by the console code when the device is later disconnected. Fixes: 73e487f ("[PATCH] USB console: fix disconnection issues") Cc: stable <[email protected]> # 2.6.18 Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent bd998c2 commit 299d757

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/usb/serial/console.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ static int usb_console_setup(struct console *co, char *options)
186186
tty_kref_put(tty);
187187
reset_open_count:
188188
port->port.count = 0;
189+
info->port = NULL;
189190
usb_autopm_put_interface(serial->interface);
190191
error_get_interface:
191192
usb_serial_put(serial);

0 commit comments

Comments
 (0)