From 799bf6db6b1513eb885418ccf77a9f20b6a3eacf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 9 Mar 2016 13:28:24 +0000 Subject: [PATCH] serial: Take care starting a hung-up tty's port tty_port_hangup sets a port's tty field to NULL (holding the port lock), but uart_tx_stopped, called from __uart_start (with the port lock), uses the tty field without checking for NULL. Change uart_tx_stopped to treat a NULL tty field as another stopped indication. Signed-off-by: Phil Elwell (cherry picked from commit 484f9ffe5efb3d0fad0c4305c0752ea96d3f4686) Signed-off-by: Paolo Pisati --- include/linux/serial_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 297d4fa..00ce6c6 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -397,7 +397,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; } -- 2.7.4