Skip to content

Commit

Permalink
printk: check CON_ENABLED in have_callable_console()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sergey Senozhatsky authored and Linus Torvalds committed Mar 17, 2016
1 parent 6b97a20 commit adaf659
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/printk/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit adaf659

Please sign in to comment.