Commit e2b39652 authored by John Ogness's avatar John Ogness Committed by Petr Mladek

tty: serial: kgdboc: use console_list_lock to trap exit

kgdboc_earlycon_init() uses the console_lock to ensure that no consoles
are unregistered until the kgdboc_earlycon is setup. The console_list_lock
should be used instead because list synchronization responsibility will
be removed from the console_lock in a later change.
Signed-off-by: default avatarJohn Ogness <john.ogness@linutronix.de>
Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20221116162152.193147-39-john.ogness@linutronix.de
parent 6193bc90
......@@ -558,13 +558,13 @@ static int __init kgdboc_earlycon_init(char *opt)
*/
/*
* Hold the console_lock to guarantee that no consoles are
* Hold the console_list_lock to guarantee that no consoles are
* unregistered until the kgdboc_earlycon setup is complete.
* Trapping the exit() callback relies on exit() not being
* called until the trap is setup. This also allows safe
* traversal of the console list and race-free reading of @flags.
*/
console_lock();
console_list_lock();
for_each_console(con) {
if (con->write && con->read &&
(con->flags & (CON_BOOT | CON_ENABLED)) &&
......@@ -606,7 +606,7 @@ static int __init kgdboc_earlycon_init(char *opt)
}
unlock:
console_unlock();
console_list_unlock();
/* Non-zero means malformed option so we always return zero */
return 0;
......
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