aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/serial/console.c
diff options
context:
space:
mode:
authorLiang He2022-09-19 18:48:24 +0800
committerJohan Hovold2022-09-19 15:30:16 +0200
commit61dfa797c731754642d1ac500a6ac42f9b47f920 (patch)
tree13bd4584403350ae7845faf4bd515a2beeb45246 /drivers/usb/serial/console.c
parent0f6632e2e8beb6a1e0895c1309dd0b84b805c202 (diff)
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: 7bd032dc2793 ("USB serial: update the console driver") Signed-off-by: Liang He <windhl@126.com> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/console.c')
-rw-r--r--drivers/usb/serial/console.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index b97aa40ca4d1..da19a5fa414f 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -189,8 +189,8 @@ static int usb_console_setup(struct console *co, char *options)
info->port = NULL;
usb_autopm_put_interface(serial->interface);
error_get_interface:
- usb_serial_put(serial);
mutex_unlock(&serial->disc_mutex);
+ usb_serial_put(serial);
return retval;
}