lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1241575205-12199-5-git-send-email-jason.wessel@windriver.com>
Date:	Tue,  5 May 2009 21:00:04 -0500
From:	Jason Wessel <jason.wessel@...driver.com>
To:	greg@...ah.com
Cc:	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	Jason Wessel <jason.wessel@...driver.com>
Subject: [PATCH 4/5] usb,early_printk: unregister early usb before rest_init()

The early_printk EHCI debug driver can hang the system or cause
unpredictable results because two separate APIs will attempt to write
to the mapped PCI region.

The safe route is to unregister the early USB console at the end of
the core kernel init, which is before the PCI initialization.  Later,
after the USB initialization completes it is then possible to register
the console against the usb debug device and receive the printk
messages that were missed in the period between early printk
availability and the USB console device.

Signed-off-by: Jason Wessel <jason.wessel@...driver.com>
---
 arch/x86/kernel/early_printk.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index e38c467..ef177d4 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -952,4 +952,26 @@ static int __init setup_early_printk(char *buf)
 	return 0;
 }
 
+#ifdef CONFIG_EARLY_PRINTK_DBGP
+/*
+ * The early console must get unregistered prior to the ECHI
+ * controller getting reset else the debug device cannot be used until
+ * a subsequent EHCI reset, or the kernel hangs.
+ */
+static int __init usb_early_debug_cleanup(void)
+{
+	if (early_dbgp_console.index >= 0 &&
+		early_dbgp_console.flags & CON_PRINTBUFFER) {
+		console_stop(early_console);
+		unregister_console(early_console);
+		early_dbgp_console.index = -1;
+		early_dbgp_console.flags = 0;
+		ehci_debug = NULL;
+		printk(KERN_INFO "Early USB console unregistered\n");
+	}
+	return 0;
+}
+postcore_initcall(usb_early_debug_cleanup);
+#endif /* CONFIG_EARLY_PRINTK_DBGP */
+
 early_param("earlyprintk", setup_early_printk);
-- 
1.6.3.rc0.1.gf800

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ