diff options
author | Benjamin Herrenschmidt | 2005-11-23 22:37:44 +0100 |
---|---|---|
committer | Linus Torvalds | 2005-11-24 01:08:39 +0100 |
commit | e9b15b54d3646108bbd3e054158b402025d3e704 (patch) | |
tree | 4e12028b9fd62fc13ad66d047f5d0052c2208e96 /kernel/printk.c | |
parent | [PATCH] fix do_wait() vs exec() race (diff) | |
download | kernel-qcow2-linux-e9b15b54d3646108bbd3e054158b402025d3e704.tar.gz kernel-qcow2-linux-e9b15b54d3646108bbd3e054158b402025d3e704.tar.xz kernel-qcow2-linux-e9b15b54d3646108bbd3e054158b402025d3e704.zip |
[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/printk.c')
-rw-r--r-- | kernel/printk.c | 2 |
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) 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) { |