]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
printk: Check CON_SUSPEND when unblanking a console
authorMarcos Paulo de Souza <mpdesouza@suse.com>
Wed, 26 Feb 2025 19:59:05 +0000 (16:59 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:42:00 +0000 (14:42 +0200)
[ Upstream commit 72c96a2dacc0fb056d13a5f02b0845c4c910fe54 ]

The commit 9e70a5e109a4 ("printk: Add per-console suspended state")
introduced the CON_SUSPENDED flag for consoles. The suspended consoles
will stop receiving messages, so don't unblank suspended consoles
because it won't be showing anything either way.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Link: https://lore.kernel.org/r/20250226-printk-renaming-v1-5-0b878577f2e6@suse.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/printk/printk.c

index dcdf449615bdaca8c20b6fef799adeb9322b1f3f..51c43e0f9b29b563d49955f86c0a9b64db00b8ef 100644 (file)
@@ -3119,7 +3119,12 @@ void console_unblank(void)
         */
        cookie = console_srcu_read_lock();
        for_each_console_srcu(c) {
-               if ((console_srcu_read_flags(c) & CON_ENABLED) && c->unblank) {
+               short flags = console_srcu_read_flags(c);
+
+               if (flags & CON_SUSPENDED)
+                       continue;
+
+               if ((flags & CON_ENABLED) && c->unblank) {
                        found_unblank = true;
                        break;
                }
@@ -3156,7 +3161,12 @@ void console_unblank(void)
 
        cookie = console_srcu_read_lock();
        for_each_console_srcu(c) {
-               if ((console_srcu_read_flags(c) & CON_ENABLED) && c->unblank)
+               short flags = console_srcu_read_flags(c);
+
+               if (flags & CON_SUSPENDED)
+                       continue;
+
+               if ((flags & CON_ENABLED) && c->unblank)
                        c->unblank();
        }
        console_srcu_read_unlock(cookie);