summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGeert Uytterhoeven2014-02-28 14:21:32 +0100
committerGreg Kroah-Hartman2014-03-01 01:39:38 +0100
commit5f5c9ae56c38942623f69c3e6dc6ec78e4da2076 (patch)
treea2b1b0fd442c91461359933b0ff9f34f5b29acbf /drivers
parenttty/serial: at91: remove unused open/close hooks (diff)
downloadkernel-qcow2-linux-5f5c9ae56c38942623f69c3e6dc6ec78e4da2076.tar.gz
kernel-qcow2-linux-5f5c9ae56c38942623f69c3e6dc6ec78e4da2076.tar.xz
kernel-qcow2-linux-5f5c9ae56c38942623f69c3e6dc6ec78e4da2076.zip
serial_core: Unregister console in uart_remove_one_port()
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/serial_core.c6
1 files changed, 6 insertions, 0 deletions
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)