LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] don't prefer unsuited consoles on registration
@ 2008-01-30  0:11 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2008-01-30  0:11 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Jason Wessel, Ingo Molnar, Andrew Morton

KGDB triggers a (probably so far theoretical) issue of the automatic
init 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>

---
 kernel/printk.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Index: b/kernel/printk.c
===================================================================
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1126,8 +1126,11 @@ void register_console(struct console *co
 			console->index = 0;
 		if (console->setup == NULL ||
 		    console->setup(console, NULL) == 0) {
-			console->flags |= CON_ENABLED | CON_CONSDEV;
-			preferred_console = 0;
+			console->flags |= CON_ENABLED;
+			if (console->device) {
+				console->flags |= CON_CONSDEV;
+				preferred_console = 0;
+			}
 		}
 	}
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-30  0:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-30  0:11 [PATCH] don't prefer unsuited consoles on registration Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).