aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorThomas Gleixner2022-11-16 17:27:13 +0106
committerPetr Mladek2022-12-02 11:24:59 +0100
commit9e409c4778afbbd44759e56ec4bbed839fd31909 (patch)
tree01fe724f81e59779518c7f1cbc8b5c83ef7c3804 /drivers
parent51f5f78a4f804aeb73cf12a7cbba6e5198abd908 (diff)
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
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/kgdboc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index 7aa37be3216a..e76f0186c335 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -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;