2022-09-10 22:59:24

by Thomas Gleixner

[permalink] [raw]
Subject: [patch RFC 09/29] serial: kgdboc: Lock consoles in probe function

Unprotected list walks are not necessarily safe.

Signed-off-by: Thomas Gleixner <[email protected]>
---
drivers/tty/serial/kgdboc.c | 2 ++
1 file changed, 2 insertions(+)

--- 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;


2022-09-14 16:04:38

by Sergey Senozhatsky

[permalink] [raw]
Subject: Re: [patch RFC 09/29] serial: kgdboc: Lock consoles in probe function

On (22/09/11 00:27), Thomas Gleixner wrote:
>
> Unprotected list walks are not necessarily safe.
>
> Signed-off-by: Thomas Gleixner <[email protected]>

For what it's worth
Reviewed-by: Sergey Senozhatsky <[email protected]>