aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2016-10-28 07:07:47 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-28 08:13:07 -0400
commit4dda864d73079a1eb01fab4ec29b97db150163bf (patch)
treee44f9cc78700fc39ee8b7b453b06c1e524f54ed9 /drivers/tty
parenttty/serial: at91: fix hardware handshake on Atmel platforms (diff)
downloadlinux-dev-4dda864d73079a1eb01fab4ec29b97db150163bf.tar.xz
linux-dev-4dda864d73079a1eb01fab4ec29b97db150163bf.zip
tty: serial_core: Fix serial console crash on port shutdown
The port->console flag is always false, as uart_console() is called before the serial console has been registered. Hence for a serial port used as the console, uart_tty_port_shutdown() will still be called when userspace closes the port, powering it down. This may lead to a system lock up when the serial console driver writes to the serial port's registers. To fix this, move the setting of port->console after the call to uart_configure_port(), which registers the serial console. Fixes: 761ed4a94582ab29 ("tty: serial_core: convert uart_close to use tty_port_close") Reported-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Rob Herring <robh@kernel.org> Tested-by: Mugunthan V N <mugunthanvnm@ti.com> Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> [robh: rebased on tty-linus] Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/serial_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 664c99aeeca5..ce8899c13af3 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2759,6 +2759,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
uart_configure_port(drv, state, uport);
+ port->console = uart_console(uport);
+
num_groups = 2;
if (uport->attr_group)
num_groups++;