Skip to content

Commit 7842055

Browse files
Ulrich Hechtgregkh
authored andcommitted
serial: sh-sci: prevent lockup on full TTY buffers
When the TTY buffers fill up to the configured maximum, a system lockup occurs: [ 598.820128] INFO: rcu_preempt detected stalls on CPUs/tasks: [ 598.825796] 0-...!: (1 GPs behind) idle=5a6/2/0 softirq=1974/1974 fqs=1 [ 598.832577] (detected by 3, t=62517 jiffies, g=296, c=295, q=126) [ 598.838755] Task dump for CPU 0: [ 598.841977] swapper/0 R running task 0 0 0 0x00000022 [ 598.849023] Call trace: [ 598.851476] __switch_to+0x98/0xb0 [ 598.854870] (null) This can be prevented by doing a dummy read of the RX data register. This issue affects both HSCIF and SCIF ports. Reported for R-Car H3 ES2.0; reproduced and fixed on H3 ES1.1. Probably affects other R-Car platforms as well. Reported-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Ulrich Hecht <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Cc: stable <[email protected]> Tested-by: Nguyen Viet Dung <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9f2068f commit 7842055

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/tty/serial/sh-sci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ static void sci_receive_chars(struct uart_port *port)
885885
/* Tell the rest of the system the news. New characters! */
886886
tty_flip_buffer_push(tport);
887887
} else {
888+
/* TTY buffers full; read from RX reg to prevent lockup */
889+
serial_port_in(port, SCxRDR);
888890
serial_port_in(port, SCxSR); /* dummy read */
889891
sci_clear_SCxSR(port, SCxSR_RDxF_CLEAR(port));
890892
}

0 commit comments

Comments
 (0)