Thread (7 messages) 7 messages, 2 authors, 2014-01-08
STALE4563d REVIEWED: 1 (0M)

[PATCH 3/4] tty/serial: at91: prevent null dereference in tasklet function

From: Nicolas Ferre <hidden>
Date: 2014-01-07 10:46:25
Also in: linux-serial, lkml, stable
Subsystem: microchip at91 serial driver, the rest, tty layer and serial drivers · Maintainers: Richard Genoud, Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby

From: Marek Roszko <redacted>

Something asks a tasklet to be scheduled when the uart port is closed.
Need to supress the kernel panic for now by checking if the port is NULL or
not.

Signed-off-by: Marek Roszko <redacted>
Acked-by: Leilei Zhao <redacted>
Cc: <redacted> # v3.12
Signed-off-by: Nicolas Ferre <redacted>
---
 drivers/tty/serial/atmel_serial.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index c421d11b3d4c..6e68486c83cb 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1360,6 +1360,10 @@ static void atmel_tasklet_func(unsigned long data)
 	unsigned int status;
 	unsigned int status_change;
 
+	if(!port->state || !port->state->port.tty)
+		/* uart has been closed */
+		return;
+
 	/* The interrupt handler does not take the lock */
 	spin_lock(&port->lock);
 
-- 
1.8.2.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help