From: Ilpo Järvinen Date: Tue, 28 Jun 2022 09:01:28 +0000 (+0300) Subject: serial: 8250_dw: Take port lock while accessing LSR X-Git-Tag: baikal/mips/sdk6.1~5078^2~53 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=95c1bb8485b7d981d6359842ddfaedc7b540d005;p=kernel.git serial: 8250_dw: Take port lock while accessing LSR Accessing LSR requires port lock because it mutates lsr_saved_flags in serial_lsr_in(). Fixes: 7895b0005f82 ("serial: 8250_dw: Use serial_lsr_in() in dw8250_handle_irq()") Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/c5879db7-bee9-93f-526e-872a292442@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 167a691c7b197..f78b13db1b1e2 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -266,7 +266,10 @@ static int dw8250_handle_irq(struct uart_port *p) /* Manually stop the Rx DMA transfer when acting as flow controller */ if (quirks & DW_UART_QUIRK_IS_DMA_FC && up->dma && up->dma->rx_running && rx_timeout) { + spin_lock_irqsave(&p->lock, flags); status = serial_lsr_in(up); + spin_unlock_irqrestore(&p->lock, flags); + if (status & (UART_LSR_DR | UART_LSR_BI)) { dw8250_writel_ext(p, RZN1_UART_RDMACR, 0); dw8250_writel_ext(p, DW_UART_DMASA, 1);