Skip to content

Commit 2085634

Browse files
jhovoldgregkh
authored andcommitted
USB: serial: console: fix use-after-free after failed setup
commit 299d7572e46f98534033a9e65973f13ad1ce9047 upstream. 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") Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6c14436 commit 2085634

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/usb/serial/console.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ static int usb_console_setup(struct console *co, char *options)
189189
tty_kref_put(tty);
190190
reset_open_count:
191191
port->port.count = 0;
192+
info->port = NULL;
192193
usb_autopm_put_interface(serial->interface);
193194
error_get_interface:
194195
usb_serial_put(serial);

0 commit comments

Comments
 (0)