Skip to content

Commit 4dda864

Browse files
geertugregkh
authored andcommitted
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: 761ed4a ("tty: serial_core: convert uart_close to use tty_port_close") Reported-by: Niklas Söderlund <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Acked-by: Rob Herring <[email protected]> Tested-by: Mugunthan V N <[email protected]> Tested-by: Niklas Söderlund <[email protected]> [robh: rebased on tty-linus] Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9bcffe7 commit 4dda864

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/tty/serial/serial_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
27592759

27602760
uart_configure_port(drv, state, uport);
27612761

2762+
port->console = uart_console(uport);
2763+
27622764
num_groups = 2;
27632765
if (uport->attr_group)
27642766
num_groups++;

0 commit comments

Comments
 (0)