提交 a727b025 编写于 作者: R Rob Herring 提交者: Greg Kroah-Hartman

tty: serial_core: add tty NULL check to uart_tx_stopped

Commit 761ed4a9 ("tty: serial_core: convert uart_close to use
tty_port_close") created a case where a port used for a console does not
get shutdown on tty closing. Then a call to uart_tx_stopped() segfaults
because the tty is NULL. This could be fixed to restore old behavior,
but we also want to allow tty_ports to work without a tty attached. So
this change to allow a NULL tty_struct is needed either way.

Fixes: 761ed4a9 ("tty: serial_core: convert uart_close to use tty_port_close")
Reported-by: Nkernel test robot <xiaolong.ye@intel.com>
Signed-off-by: NRob Herring <robh@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 e5e89602
......@@ -412,7 +412,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
static inline int uart_tx_stopped(struct uart_port *port)
{
struct tty_struct *tty = port->state->port.tty;
if (tty->stopped || port->hw_stopped)
if ((tty && tty->stopped) || port->hw_stopped)
return 1;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册