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

Thomas Gleixner posted 29 patches 3 years, 6 months ago
[patch RFC 09/29] serial: kgdboc: Lock consoles in probe function
Posted by Thomas Gleixner 3 years, 6 months ago
Unprotected list walks are not necessarily safe.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 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;
Re: [patch RFC 09/29] serial: kgdboc: Lock consoles in probe function
Posted by Sergey Senozhatsky 3 years, 6 months ago
On (22/09/11 00:27), Thomas Gleixner wrote:
> 
> Unprotected list walks are not necessarily safe.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

For what it's worth
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>