sysrq: Restore original console_loglevel when sysrq disabled

This change “sysrq: Restore original console_loglevel when sysrq disabled” in Linux kernel is authored by Petr Mladek <pmladek [at]> on Fri Jan 11 13:45:15 2019 +0100.

sysrq: Restore original console_loglevel when sysrq disabled

The sysrq header line is printed with an increased loglevel
to provide users some positive feedback.

The original loglevel is not restored when the sysrq operation
is disabled. This bug was introduced in 2.6.12 (pre-git-history)
by the commit ("Allow admin to enable only some of the Magic-Sysrq

Signed-off-by: Petr Mladek <>
Reviewed-by: Sergey Senozhatsky <>
Reviewed-by: Steven Rostedt (VMware) <>
Signed-off-by: Greg Kroah-Hartman <>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 075e1a0.

There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/tty/sysrq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 1f03078..2e4e184 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -553,6 +553,7 @@ void __handle_sysrq(int key, bool check_mask)
 		} else {
 			pr_cont("This sysrq operation is disabled.n");
+			console_loglevel = orig_log_level;
 	} else {
 		pr_cont("HELP : ");

The commit for this change in Linux stable tree is 075e1a0 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *