Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit aae20f6

Browse files
Wolfram Sanggregkh
authored andcommitted
serial: sh-sci: protect invalidating RXDMA on shutdown
The to-be-fixed commit removed locking when invalidating the DMA RX descriptors on shutdown. It overlooked that there is still a rx_timer running which may still access the protected data. So, re-add the locking. Reported-by: Dirk Behme <dirk.behme@de.bosch.com> Closes: https://lore.kernel.org/r/ee6c9e16-9f29-450e-81da-4a8dceaa8fc7@de.bosch.com Fixes: 2c4ee23 ("serial: sh-sci: Postpone DMA release when falling back to PIO") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20240506114016.30498-7-wsa+renesas@sang-engineering.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6bd23e0 commit aae20f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/tty/serial/sh-sci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,9 +1270,14 @@ static void sci_dma_rx_chan_invalidate(struct sci_port *s)
12701270
static void sci_dma_rx_release(struct sci_port *s)
12711271
{
12721272
struct dma_chan *chan = s->chan_rx_saved;
1273+
struct uart_port *port = &s->port;
1274+
unsigned long flags;
12731275

1276+
uart_port_lock_irqsave(port, &flags);
12741277
s->chan_rx_saved = NULL;
12751278
sci_dma_rx_chan_invalidate(s);
1279+
uart_port_unlock_irqrestore(port, flags);
1280+
12761281
dmaengine_terminate_sync(chan);
12771282
dma_free_coherent(chan->device->dev, s->buf_len_rx * 2, s->rx_buf[0],
12781283
sg_dma_address(&s->sg_rx[0]));

0 commit comments

Comments
 (0)