Skip to content

Commit 7e537af

Browse files
jognesspmladek
authored andcommitted
tty: serial: kgdboc: use srcu console list iterator
Use srcu console list iteration for safe console list traversal. Note that this is a preparatory change for when console_lock no longer provides synchronization for the console list. Signed-off-by: John Ogness <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 28de287 commit 7e537af

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/tty/serial/kgdboc.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ static void kgdboc_earlycon_pre_exp_handler(void)
451451
{
452452
struct console *con;
453453
static bool already_warned;
454+
int cookie;
454455

455456
if (already_warned)
456457
return;
@@ -463,9 +464,14 @@ static void kgdboc_earlycon_pre_exp_handler(void)
463464
* serial drivers might be OK with this, print a warning once per
464465
* boot if we detect this case.
465466
*/
466-
for_each_console(con)
467+
cookie = console_srcu_read_lock();
468+
for_each_console_srcu(con) {
467469
if (con == kgdboc_earlycon_io_ops.cons)
468-
return;
470+
break;
471+
}
472+
console_srcu_read_unlock(cookie);
473+
if (con)
474+
return;
469475

470476
already_warned = true;
471477
pr_warn("kgdboc_earlycon is still using bootconsole\n");

0 commit comments

Comments
 (0)