blob: 494b6227e9d061f7967f63c73b527b389af27e40 [file] [log] [blame]
From 2b09764943e4c28d1c8e4b3f442e0e6f6c232dc8 Mon Sep 17 00:00:00 2001
From: John Ogness <>
Date: Thu, 19 Dec 2019 12:59:22 +0106
Subject: [PATCH] printk: fix exclusive_console replaying
commit def97da136515cb289a14729292c193e0a93bc64 upstream.
Commit f92b070f2dc8 ("printk: Do not miss new messages when replaying
the log") introduced a new variable @exclusive_console_stop_seq to
store when an exclusive console should stop printing. It should be
set to the @console_seq value at registration. However, @console_seq
is previously set to @syslog_seq so that the exclusive console knows
where to begin. This results in the exclusive console immediately
reactivating all the other consoles and thus repeating the messages
for those consoles.
Set @console_seq after @exclusive_console_stop_seq has stored the
current @console_seq value.
Fixes: f92b070f2dc8 ("printk: Do not miss new messages when replaying the log")
Cc: Steven Rostedt <>
Signed-off-by: John Ogness <>
Acked-by: Sergey Senozhatsky <>
Signed-off-by: Petr Mladek <>
Signed-off-by: Paul Gortmaker <>
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 424abf802f02..426d1f318706 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2760,8 +2760,6 @@ void register_console(struct console *newcon)
* for us.
- console_seq = syslog_seq;
- console_idx = syslog_idx;
* We're about to replay the log buffer. Only do this to the
* just-registered console to avoid excessive message spam to
@@ -2773,6 +2771,8 @@ void register_console(struct console *newcon)
exclusive_console = newcon;
exclusive_console_stop_seq = console_seq;
+ console_seq = syslog_seq;
+ console_idx = syslog_idx;