Commit 3e30e75b authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Greg Kroah-Hartman

serial: sh-sci: Fix crash in rx_timer_fn() on PIO fallback

[ Upstream commit 2e948218 ]

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: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent df3a72c9
...@@ -1359,7 +1359,7 @@ static int sci_submit_rx(struct sci_port *s, bool port_lock_held) ...@@ -1359,7 +1359,7 @@ static int sci_submit_rx(struct sci_port *s, bool port_lock_held)
dmaengine_terminate_async(chan); dmaengine_terminate_async(chan);
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
s->cookie_rx[i] = -EINVAL; s->cookie_rx[i] = -EINVAL;
s->active_rx = -EINVAL; s->active_rx = 0;
s->chan_rx = NULL; s->chan_rx = NULL;
sci_start_rx(port); sci_start_rx(port);
if (!port_lock_held) if (!port_lock_held)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment