aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@web.de>2008-05-12 15:21:04 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-24 17:15:07 -0400
commitcd3a1b8562d28490b334a61d5eb05df3d722d91e (patch)
treea0143f57cdc9e22fe8c0498e48a029c3fd7177ef /kernel
parent3b8945e8d40645eecdb7d2357ca531f9b4dd9f71 (diff)
printk: don't prefer unsuited consoles on registration
console election: If some console happens to be registered first which does not provide a tty binding (!console->device), it prevents that more suited consoles which are registered later on can enter the candidate pool for console_device(). This is observable with KGDB's console which may already be registered (and exploited!) during early debugger connections, that is before any regular console registration. This patch fixes the issue by postponing the final, automated preferred_console selection until someone with a non-NULL device handler comes around. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Gerd Hoffmann <kraxel@suse.de> Cc: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/printk.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 8b42f87e311d..7d5556152234 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1157,8 +1157,11 @@ void register_console(struct console *console)
1157 console->index = 0; 1157 console->index = 0;
1158 if (console->setup == NULL || 1158 if (console->setup == NULL ||
1159 console->setup(console, NULL) == 0) { 1159 console->setup(console, NULL) == 0) {
1160 console->flags |= CON_ENABLED | CON_CONSDEV; 1160 console->flags |= CON_ENABLED;
1161 preferred_console = 0; 1161 if (console->device) {
1162 console->flags |= CON_CONSDEV;
1163 preferred_console = 0;
1164 }
1162 } 1165 }
1163 } 1166 }
1164 1167