From: Radu Pirea <[email protected]>
Take the port->lock when set_termios is called, otherwise if characters
are sent while IP is in init mode, the IP will hang in an uncertain
state.
Fixes: 09864c1cdf5c ("tty: serial: Add linflexuart driver for S32V234")
Signed-off-by: Radu Pirea <[email protected]>
Signed-off-by: Larisa Grigore <[email protected]>
---
drivers/tty/serial/fsl_linflexuart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/fsl_linflexuart.c
b/drivers/tty/serial/fsl_linflexuart.c
index e70a56de1fce..5a410e2d56ac 100644
--- a/drivers/tty/serial/fsl_linflexuart.c
+++ b/drivers/tty/serial/fsl_linflexuart.c
@@ -407,6 +407,8 @@ linflex_set_termios(struct uart_port *port, struct ktermios
*termios,
unsigned long cr, old_cr, cr1;
unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
+ uart_port_lock_irqsave(port, &flags);
+
cr = readl(port->membase + UARTCR);
old_cr = cr;
@@ -475,8 +477,6 @@ linflex_set_termios(struct uart_port *port, struct ktermios
*termios,
cr &= ~LINFLEXD_UARTCR_PCE;
}
- uart_port_lock_irqsave(port, &flags);
-
port->read_status_mask = 0;
if (termios->c_iflag & INPCK)
--
2.47.0