This is a note to let you know that I've just added the patch titled

    tty/serial: at91: fix race condition in atmel_serial_remove

to the 3.12-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tty-serial-at91-fix-race-condition-in-atmel_serial_remove.patch
and it can be found in the queue-3.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From f50c995f9ebf064cea1368bf361c4e29679415b4 Mon Sep 17 00:00:00 2001
From: Marek Roszko <[email protected]>
Date: Tue, 7 Jan 2014 11:45:07 +0100
Subject: tty/serial: at91: fix race condition in atmel_serial_remove

From: Marek Roszko <[email protected]>

commit f50c995f9ebf064cea1368bf361c4e29679415b4 upstream.

The _remove callback could be called when a tasklet is scheduled. tasklet_kill
was called inside the function in order to free up any scheduled tasklets.
However it was called after uart_remove_one_port which destroys tty references
needed in the port for atmel_tasklet_func.
Simply putting the tasklet_kill at the start of the function will prevent this
conflict.

Signed-off-by: Marek Roszko <[email protected]>
Acked-by: Leilei Zhao <[email protected]>
Signed-off-by: Nicolas Ferre <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/tty/serial/atmel_serial.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2430,11 +2430,12 @@ static int atmel_serial_remove(struct pl
        struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
        int ret = 0;
 
+       tasklet_kill(&atmel_port->tasklet);
+
        device_init_wakeup(&pdev->dev, 0);
 
        ret = uart_remove_one_port(&atmel_uart, port);
 
-       tasklet_kill(&atmel_port->tasklet);
        kfree(atmel_port->rx_ring.buf);
 
        /* "port" is allocated statically, so we shouldn't free it */


Patches currently in stable-queue which might be from [email protected] are

queue-3.12/tty-serial-at91-disable-uart-timer-at-start-of-shutdown.patch
queue-3.12/tty-serial-at91-fix-race-condition-in-atmel_serial_remove.patch
queue-3.12/tty-serial-at91-handle-shutdown-more-safely.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to