提交 4dda864d 编写于 作者: G Geert Uytterhoeven 提交者: Greg Kroah-Hartman

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: 761ed4a9 ("tty: serial_core: convert uart_close to use tty_port_close")
Reported-by: NNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Acked-by: NRob Herring <robh@kernel.org>
Tested-by: NMugunthan V N <mugunthanvnm@ti.com>
Tested-by: NNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
[robh: rebased on tty-linus]
Signed-off-by: NRob Herring <robh@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 9bcffe75
...@@ -2759,6 +2759,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) ...@@ -2759,6 +2759,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
uart_configure_port(drv, state, uport); uart_configure_port(drv, state, uport);
port->console = uart_console(uport);
num_groups = 2; num_groups = 2;
if (uport->attr_group) if (uport->attr_group)
num_groups++; num_groups++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册