2022-10-19 15:08:43

by John Ogness

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

From: Thomas Gleixner <[email protected]>

Unprotected list walks are not necessarily safe.

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: John Ogness <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
---
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


2022-10-19 15:59:42

by Greg Kroah-Hartman

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

On Wed, Oct 19, 2022 at 05:01:23PM +0206, John Ogness wrote:
> From: Thomas Gleixner <[email protected]>
>
> Unprotected list walks are not necessarily safe.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> Signed-off-by: John Ogness <[email protected]>
> Reviewed-by: Petr Mladek <[email protected]>
> ---
> drivers/tty/serial/kgdboc.c | 2 ++
> 1 file changed, 2 insertions(+)

Reviewed-by: Greg Kroah-Hartman <[email protected]>

2022-10-24 05:24:48

by Sergey Senozhatsky

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

On (22/10/19 17:01), John Ogness wrote:
> From: Thomas Gleixner <[email protected]>
>
> Unprotected list walks are not necessarily safe.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> Signed-off-by: John Ogness <[email protected]>
> Reviewed-by: Petr Mladek <[email protected]>

Reviewed-by: Sergey Senozhatsky <[email protected]>

2022-10-25 02:53:37

by Doug Anderson

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

Hi,

On Wed, Oct 19, 2022 at 7:56 AM John Ogness <[email protected]> wrote:
>
> From: Thomas Gleixner <[email protected]>
>
> Unprotected list walks are not necessarily safe.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> Signed-off-by: John Ogness <[email protected]>
> Reviewed-by: Petr Mladek <[email protected]>
> ---
> drivers/tty/serial/kgdboc.c | 2 ++
> 1 file changed, 2 insertions(+)

Reviewed-by: Douglas Anderson <[email protected]>