* [PATCH] m68k: nfcon: don't call console_is_registered in nfcon_device
@ 2026-08-15 7:24 Andreas Schwab
2026-08-17 9:26 ` Geert Uytterhoeven
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2026-08-15 7:24 UTC (permalink / raw)
To: linux-m68k
Since 7c2af0f634f1 ("tty: tty_io: use console_list_lock for list
synchronization") show_cons_active calls the device method under the
console_list_lock, but console_is_registered tries to acquire
console_list_lock as well, causing a deadlock. It should not be necessary
to check console_is_registered here since the function should not be
called in the fist place when the console is not registered.
Fixes: 7c2af0f634f1 ("tty: tty_io: use console_list_lock for list synchronization")
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
arch/m68k/emu/nfcon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/m68k/emu/nfcon.c b/arch/m68k/emu/nfcon.c
index d41260672e24..f4657d9f4f15 100644
--- a/arch/m68k/emu/nfcon.c
+++ b/arch/m68k/emu/nfcon.c
@@ -49,7 +49,7 @@ static void nfcon_write(struct console *con, const char *str,
static struct tty_driver *nfcon_device(struct console *con, int *index)
{
*index = 0;
- return console_is_registered(con) ? nfcon_tty_driver : NULL;
+ return nfcon_tty_driver;
}
static struct console nf_console = {
--
2.55.0
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] m68k: nfcon: don't call console_is_registered in nfcon_device
2026-08-15 7:24 [PATCH] m68k: nfcon: don't call console_is_registered in nfcon_device Andreas Schwab
@ 2026-08-17 9:26 ` Geert Uytterhoeven
0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2026-08-17 9:26 UTC (permalink / raw)
To: Andreas Schwab
Cc: linux-m68k, John Ogness, Petr Mladek, open list:SERIAL DRIVERS
Hi Andreas,
CC john, petr, serial
Thanks for your patch!
On Sat, 15 Aug 2026 at 09:33, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Since 7c2af0f634f1 ("tty: tty_io: use console_list_lock for list
> synchronization") show_cons_active calls the device method under the
> console_list_lock, but console_is_registered tries to acquire
> console_list_lock as well, causing a deadlock. It should not be necessary
> to check console_is_registered here since the function should not be
> called in the fist place when the console is not registered.
Nice catch!
> Fixes: 7c2af0f634f1 ("tty: tty_io: use console_list_lock for list synchronization")
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k tree for v7.3.
> --- a/arch/m68k/emu/nfcon.c
> +++ b/arch/m68k/emu/nfcon.c
> @@ -49,7 +49,7 @@ static void nfcon_write(struct console *con, const char *str,
> static struct tty_driver *nfcon_device(struct console *con, int *index)
> {
> *index = 0;
> - return console_is_registered(con) ? nfcon_tty_driver : NULL;
Interestingly, that call to console_is_registered() was added in
commit de61a1a3a0830710 ("tty: nfcon: use console_is_registered()"),
i.e. in the same series that added the extra locking...
> + return nfcon_tty_driver;
> }
>
> static struct console nf_console = {
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-17 9:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-15 7:24 [PATCH] m68k: nfcon: don't call console_is_registered in nfcon_device Andreas Schwab
2026-08-17 9:26 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox