public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ensure we don't use bootconsoles after init has been released
@ 2007-08-20  2:46 Robin Getz
  2007-08-20  3:11 ` Mike Frysinger
  2007-08-22  3:14 ` [PATCH 1/1] fix - " Robin Getz
  0 siblings, 2 replies; 10+ messages in thread
From: Robin Getz @ 2007-08-20  2:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: torvalds, linux-kernel, Gerd Hoffmann

From: Robin Getz <rgetz@blackfin.uclinux.org>

This is a followup to the cleanups for earlyprintk patch from Gerd Hoffmann

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=69331af79cf29e26d1231152a172a1a10c2df511

This ensures that a bootconsole is unregistered if it is not replaced. 
The current implementation spews garbage out the bootconsole in this case,
since the bootconsole structure is normally in the init section, and is
freed, but still used.

Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>

---
 linux-2.6.x/kernel/printk.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)


Index: linux-2.6.x/kernel/printk.c
===================================================================
--- linux-2.6.x/kernel/printk.c
+++ linux-2.6.x/kernel/printk.c
@@ -1104,6 +1104,20 @@
 }
 EXPORT_SYMBOL(unregister_console);
 
+static int __init disable_boot_consoles(void)
+{
+	struct console *con;
+
+	for (con = console_drivers; con; con = con->next) {
+		if (con->flags & CON_BOOT) {
+			printk(KERN_INFO "Turn off boot console %s%d\n",
+				con->name, con->index);
+			unregister_console(con);
+		}
+	}
+}
+late_initcall(disable_boot_consoles);
+
 /**
  * tty_write_message - write a message to a certain tty, not just the console.
  * @tty: the destination tty_struct

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-08-22  3:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-20  2:46 [PATCH 1/1] ensure we don't use bootconsoles after init has been released Robin Getz
2007-08-20  3:11 ` Mike Frysinger
2007-08-20  3:31   ` Paul Mundt
2007-08-20 17:14     ` Robin Getz
2007-08-20 19:07       ` Gerd Hoffmann
2007-08-20 19:22     ` Robin Getz
2007-08-20 19:26       ` Gerd Hoffmann
2007-08-20 22:47       ` Paul Mundt
2007-08-20  4:08   ` Robin Getz
2007-08-22  3:14 ` [PATCH 1/1] fix - " Robin Getz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox