]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
serial: sh-sci: Fix crash in rx_timer_fn() on PIO fallback
authorGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 13 Dec 2018 18:44:42 +0000 (19:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Dec 2018 14:04:11 +0000 (15:04 +0100)
When falling back to PIO, active_rx must be set to a different value
than cookie_rx[i], else sci_dma_rx_find_active() will incorrectly find a
match, leading to a NULL pointer dereference in rx_timer_fn() later.

Use zero instead, which is the same value as after driver
initialization.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c

index 2a08039f792235e520a85a3168f526a1b9e6665d..e353e03ce2602559e605f8610952bc97178d627b 100644 (file)
@@ -1369,7 +1369,7 @@ static void sci_submit_rx(struct sci_port *s, bool port_lock_held)
                dmaengine_terminate_async(chan);
        for (i = 0; i < 2; i++)
                s->cookie_rx[i] = -EINVAL;
-       s->active_rx = -EINVAL;
+       s->active_rx = 0;
        s->chan_rx = NULL;
        sci_start_rx(port);
        if (!port_lock_held)