From: John Ogness Date: Tue, 20 Aug 2024 06:29:51 +0000 (+0206) Subject: printk: Flush nbcon consoles first on panic X-Git-Tag: v6.12-rc1~192^2~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2e85ca7a736d2d889bac9aef6ede0a67f6870b2;p=thirdparty%2Flinux.git printk: Flush nbcon consoles first on panic In console_flush_on_panic(), flush the nbcon consoles before flushing legacy consoles. The legacy write() callbacks are not fully safe when oops_in_progress is set. Signed-off-by: John Ogness Reviewed-by: Petr Mladek Link: https://lore.kernel.org/r/20240820063001.36405-26-john.ogness@linutronix.de Signed-off-by: Petr Mladek --- diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 7c9f8f6e17387..c6e633329e4d5 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -3269,6 +3269,9 @@ void console_flush_on_panic(enum con_flush_mode mode) if (mode == CONSOLE_REPLAY_ALL) __console_rewind_all(); + if (!have_boot_console) + nbcon_atomic_flush_pending(); + console_flush_all(false, &next_seq, &handover); }