Thread (40 messages) 40 messages, 5 authors, 2022-11-07

[PATCH printk v2 01/38] serial: kgdboc: Lock console list in probe function

From: John Ogness <john.ogness@linutronix.de>
Date: 2022-10-19 15:03:05
Also in: lkml
Subsystem: kgdb / kdb /debug_core, the rest, tty layer and serial drivers · Maintainers: Jason Wessel, Daniel Thompson, Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby

From: Thomas Gleixner <redacted>

Unprotected list walks are not necessarily safe.

Signed-off-by: Thomas Gleixner <redacted>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
---
 drivers/tty/serial/kgdboc.c | 2 ++
 1 file changed, 2 insertions(+)
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;
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help