]> git.baikalelectronics.ru Git - kernel.git/commit
tty: serial_core: Fix serial console crash on port shutdown
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 28 Oct 2016 12:07:47 +0000 (07:07 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Oct 2016 12:13:07 +0000 (08:13 -0400)
commit3f208ca8c30ffcf15f7f64ce9dd6256f85caf197
treee44f9cc78700fc39ee8b7b453b06c1e524f54ed9
parent9672bde0fb2fb3fe3140f8dffd7cf80632c7f556
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: 42d88fe325cf78ef ("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>
drivers/tty/serial/serial_core.c