OSDN Git Service

serial: sh-sci: Stop RX FIFO timer during port shutdown
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 6 Jul 2018 09:08:36 +0000 (11:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Jul 2018 14:41:15 +0000 (16:41 +0200)
The RX FIFO timer may be armed when the port is shut down, hence the
timer function may still be called afterwards.

Fix this race condition by deleting the timer during port shutdown.

Fixes: 039403765e5da3c6 ("serial: sh-sci: SCIFA/B RX FIFO software timeout")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c

index c181eb3..3c55600 100644 (file)
@@ -2099,6 +2099,8 @@ static void sci_shutdown(struct uart_port *port)
        }
 #endif
 
+       if (s->rx_trigger > 1 && s->rx_fifo_timeout > 0)
+               del_timer_sync(&s->rx_fifo_timer);
        sci_free_irq(s);
        sci_free_dma(port);
 }