aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-11-23 16:37:44 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-23 19:08:39 -0500
commite9b15b54d3646108bbd3e054158b402025d3e704 (patch)
tree4e12028b9fd62fc13ad66d047f5d0052c2208e96 /kernel
parent962b564cf1ec8041e8890a3c3847e3a630a08f42 (diff)
[PATCH] Fix crash in unregister_console()
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... (akpm: It'd be better to make register_console() return something and fix the callers. All 106 of them...) Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/printk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index ac8a08f36207..5287be83e3e7 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -956,7 +956,7 @@ int unregister_console(struct console *console)
956 if (console_drivers == console) { 956 if (console_drivers == console) {
957 console_drivers=console->next; 957 console_drivers=console->next;
958 res = 0; 958 res = 0;
959 } else { 959 } else if (console_drivers) {
960 for (a=console_drivers->next, b=console_drivers ; 960 for (a=console_drivers->next, b=console_drivers ;
961 a; b=a, a=b->next) { 961 a; b=a, a=b->next) {
962 if (a == console) { 962 if (a == console) {