serial: kgdboc: Lock console list in probe function

Unprotected list walks are not necessarily safe.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20221116162152.193147-2-john.ogness@linutronix.de
This commit is contained in:
Thomas Gleixner 2022-11-16 17:27:13 +01:06 committed by Petr Mladek
parent 51f5f78a4f
commit 9e409c4778

View File

@ -193,6 +193,7 @@ static int configure_kgdboc(void)
if (!p)
goto noconfig;
console_lock();
for_each_console(cons) {
int idx;
if (cons->device && cons->device(cons, &idx) == p &&
@ -201,6 +202,7 @@ static int configure_kgdboc(void)
break;
}
}
console_unlock();
kgdb_tty_driver = p;
kgdb_tty_line = tty_line;