openwrtv4/target/linux/brcm2708/patches-4.4/0202-serial-Take-care-starting-a-hung-up-tty-s-port.patch
Álvaro Fernández Rojas 2b1c6b21b5 brcm2708: update linux 4.4 patches to latest version
As usual these patches were extracted and rebased from the raspberry pi repo:
https://github.com/raspberrypi/linux/tree/rpi-4.4.y

Also adds support for Raspberry Pi Compute Module 3 (untested).

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2016-09-10 14:54:26 +02:00

28 lines
978 B
Diff

From baaee4dd48573d8de4e22d812717c6863ba4b7e6 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
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 <phil@raspberrypi.org>
---
include/linux/serial_core.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -397,7 +397,7 @@ int uart_resume_port(struct uart_driver
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;
}