diff options
-rw-r--r-- | kernel/printk.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 668df351e6a9..e0daaf57985a 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -67,6 +67,8 @@ int console_printk[4] = { | |||
67 | DEFAULT_CONSOLE_LOGLEVEL, /* default_console_loglevel */ | 67 | DEFAULT_CONSOLE_LOGLEVEL, /* default_console_loglevel */ |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static int saved_console_loglevel = -1; | ||
71 | |||
70 | /* | 72 | /* |
71 | * Low level drivers may need that to know if they can schedule in | 73 | * Low level drivers may need that to know if they can schedule in |
72 | * their unblank() callback or not. So let's export it. | 74 | * their unblank() callback or not. So let's export it. |
@@ -378,10 +380,15 @@ int do_syslog(int type, char __user *buf, int len) | |||
378 | logged_chars = 0; | 380 | logged_chars = 0; |
379 | break; | 381 | break; |
380 | case 6: /* Disable logging to console */ | 382 | case 6: /* Disable logging to console */ |
383 | if (saved_console_loglevel == -1) | ||
384 | saved_console_loglevel = console_loglevel; | ||
381 | console_loglevel = minimum_console_loglevel; | 385 | console_loglevel = minimum_console_loglevel; |
382 | break; | 386 | break; |
383 | case 7: /* Enable logging to console */ | 387 | case 7: /* Enable logging to console */ |
384 | console_loglevel = default_console_loglevel; | 388 | if (saved_console_loglevel != -1) { |
389 | console_loglevel = saved_console_loglevel; | ||
390 | saved_console_loglevel = -1; | ||
391 | } | ||
385 | break; | 392 | break; |
386 | case 8: /* Set level of messages printed to console */ | 393 | case 8: /* Set level of messages printed to console */ |
387 | error = -EINVAL; | 394 | error = -EINVAL; |
@@ -390,6 +397,8 @@ int do_syslog(int type, char __user *buf, int len) | |||
390 | if (len < minimum_console_loglevel) | 397 | if (len < minimum_console_loglevel) |
391 | len = minimum_console_loglevel; | 398 | len = minimum_console_loglevel; |
392 | console_loglevel = len; | 399 | console_loglevel = len; |
400 | /* Implicitly re-enable logging to console */ | ||
401 | saved_console_loglevel = -1; | ||
393 | error = 0; | 402 | error = 0; |
394 | break; | 403 | break; |
395 | case 9: /* Number of chars in the log buffer */ | 404 | case 9: /* Number of chars in the log buffer */ |