All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix crash in unregister_console()
@ 2005-11-23  6:47 Benjamin Herrenschmidt
  0 siblings, 0 replies; only message in thread
From: Benjamin Herrenschmidt @ 2005-11-23  6:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel list

If unregister_console() is inadvertently called while no consoles are
registered, it will crash trying to dereference NULL pointer. It is
necessary to fix that because register_console() provides no indication
that it actually registered the console passed in. In fact, it may well
decide not to register it based on various things...

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Index: linux-serialfix/kernel/printk.c
===================================================================
--- linux-serialfix.orig/kernel/printk.c	2005-11-15 11:54:14.000000000 +1100
+++ linux-serialfix/kernel/printk.c	2005-11-23 17:47:11.000000000 +1100
@@ -956,7 +956,7 @@ int unregister_console(struct console *c
 	if (console_drivers == console) {
 		console_drivers=console->next;
 		res = 0;
-	} else {
+	} else if (console_drivers) {
 		for (a=console_drivers->next, b=console_drivers ;
 		     a; b=a, a=b->next) {
 			if (a == console) {



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

only message in thread, other threads:[~2005-11-23  6:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-23  6:47 [PATCH] Fix crash in unregister_console() Benjamin Herrenschmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.