Commit 61dfa797 authored by Liang He's avatar Liang He Committed by Johan Hovold

USB: serial: console: move mutex_unlock() before usb_serial_put()

While in current version there is no use-after-free as USB serial
core holds another reference when the console is registered, we
should better unlock before dropping the reference in
usb_console_setup().

Fixes: 7bd032dc ("USB serial: update the console driver")
Signed-off-by: default avatarLiang He <windhl@126.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 0f6632e2
...@@ -189,8 +189,8 @@ static int usb_console_setup(struct console *co, char *options) ...@@ -189,8 +189,8 @@ static int usb_console_setup(struct console *co, char *options)
info->port = NULL; info->port = NULL;
usb_autopm_put_interface(serial->interface); usb_autopm_put_interface(serial->interface);
error_get_interface: error_get_interface:
usb_serial_put(serial);
mutex_unlock(&serial->disc_mutex); mutex_unlock(&serial->disc_mutex);
usb_serial_put(serial);
return retval; return retval;
} }
......
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