summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2016-03-17 22:21:27 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 23:09:34 +0100
commitadaf6590ee7db23c3a124fb9f213c90c15cecf96 (patch)
tree40b3a1fc2ba5871dab98e0200eae76c09a72156a
parentprintk: set may_schedule for some of console_trylock() callers (diff)
downloadlinux-adaf6590ee7db23c3a124fb9f213c90c15cecf96.tar.xz
linux-adaf6590ee7db23c3a124fb9f213c90c15cecf96.zip
printk: check CON_ENABLED in have_callable_console()
have_callable_console() must also test CON_ENABLED bit, not just CON_ANYTIME. We may have disabled CON_ANYTIME console so printk can wrongly assume that it's safe to call_console_drivers(). Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Cc: Jan Kara <jack@suse.com> Cc: Tejun Heo <tj@kernel.org> Cc: Kyle McMartin <kyle@kernel.org> Cc: Dave Jones <davej@codemonkey.org.uk> Cc: Calvin Owens <calvinowens@fb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/printk/printk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index a6d023c3b852..d5fd844e5b08 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2146,7 +2146,8 @@ static int have_callable_console(void)
struct console *con;
for_each_console(con)
- if (con->flags & CON_ANYTIME)
+ if ((con->flags & CON_ENABLED) &&
+ (con->flags & CON_ANYTIME))
return 1;
return 0;