printk: check CON_ENABLED in have_callable_console()
authorSergey Senozhatsky <[email protected]>
Thu, 17 Mar 2016 21:21:27 +0000 (14:21 -0700)
committerLinus Torvalds <[email protected]>
Thu, 17 Mar 2016 22:09:34 +0000 (15:09 -0700)
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 <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Dave Jones <[email protected]>
Cc: Calvin Owens <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/printk/printk.c

index a6d023c3b852f254ed0ae2234f586ca256d6d3a4..d5fd844e5b08a1b5865ae271c1985ee66945a6dc 100644 (file)
@@ -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;