brcm2708: update linux 4.4 patches to latest version
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0202-serial-Take-care-starting-a-hung-up-tty-s-port.patch
1 From abd2da573a492fe1c64fa7a269b121046b2f3acf Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Wed, 9 Mar 2016 13:28:24 +0000
4 Subject: [PATCH 202/304] serial: Take care starting a hung-up tty's port
5
6 tty_port_hangup sets a port's tty field to NULL (holding the port lock),
7 but uart_tx_stopped, called from __uart_start (with the port lock),
8 uses the tty field without checking for NULL.
9
10 Change uart_tx_stopped to treat a NULL tty field as another stopped
11 indication.
12
13 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
14 ---
15 include/linux/serial_core.h | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18 --- a/include/linux/serial_core.h
19 +++ b/include/linux/serial_core.h
20 @@ -397,7 +397,7 @@ int uart_resume_port(struct uart_driver
21 static inline int uart_tx_stopped(struct uart_port *port)
22 {
23 struct tty_struct *tty = port->state->port.tty;
24 - if (tty->stopped || port->hw_stopped)
25 + if (!tty || tty->stopped || port->hw_stopped)
26 return 1;
27 return 0;
28 }