Re: [PATCH] m68k: nfcon: don't call console_is_registered in nfcon_device

Geert Uytterhoeven <[email protected]>
Newsgroups org.kernel.vger.linux-serial,org.kernel.vger.linux-m68k
Message-ID <CAMuHMdU4C+W6Tpsn3Vr_kqmuU2Vzg7ExXhspmB5qNWMZ3Wnfeg@mail.gmail.com>
Hi Andreas,

CC john, petr, serial

Thanks for your patch!

On Sat, 15 Aug 2026 at 09:33, Andreas Schwab <[email protected]> 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 <[email protected]>

Reviewed-by: Geert Uytterhoeven <[email protected]>
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 -- [email protected]

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.