linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] serial_core: Unregister console in uart_remove_one_port()
@ 2014-02-28 13:21 Geert Uytterhoeven
  2014-02-28 13:21 ` [PATCH 2/2] serial: sh-sci: Add missing call to uart_remove_one_port() in failure path Geert Uytterhoeven
  2014-03-11  1:06 ` [PATCH 1/2] serial_core: Unregister console in uart_remove_one_port() Peter Hurley
  0 siblings, 2 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2014-02-28 13:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Laurent Pinchart, linux-serial, linux-sh, linux-kernel,
	Geert Uytterhoeven

From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>

If the serial port being removed is used as a console, it must also be
unregistered from the console subsystem using unregister_console().

uart_ops.release_port() will release resources (e.g. iounmap() the serial
port registers), causing a crash on subsequent kernel output if the console
is still registered.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
---
 drivers/tty/serial/serial_core.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index ece2049bd270..8ece7f14d89d 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2677,6 +2677,12 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
 		tty_vhangup(port->tty);
 
 	/*
+	 * If the port is used as a console, unregister it
+	 */
+	if (uart_console(uport))
+		unregister_console(uport->cons);
+
+	/*
 	 * Free the port IO and memory resources, if any.
 	 */
 	if (uport->type != PORT_UNKNOWN)
-- 
1.7.9.5


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

end of thread, other threads:[~2014-03-11  3:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-28 13:21 [PATCH 1/2] serial_core: Unregister console in uart_remove_one_port() Geert Uytterhoeven
2014-02-28 13:21 ` [PATCH 2/2] serial: sh-sci: Add missing call to uart_remove_one_port() in failure path Geert Uytterhoeven
2014-03-06  4:19   ` Simon Horman
2014-03-06  4:34     ` Greg Kroah-Hartman
2014-03-11  1:06 ` [PATCH 1/2] serial_core: Unregister console in uart_remove_one_port() Peter Hurley
2014-03-11  3:43   ` Peter Hurley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).