From: Jorge Ramirez-Ortiz Date: Mon, 10 Jun 2019 17:23:08 +0000 (+0200) Subject: tty: serial: msm_serial: avoid system lockup condition X-Git-Tag: v5.4-rc1~601^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba3684f99f1b25d2a30b6956d02d339d7acb9799;p=platform%2Fkernel%2Flinux-rpi.git tty: serial: msm_serial: avoid system lockup condition The function msm_wait_for_xmitr can be taken with interrupts disabled. In order to avoid a potential system lockup - demonstrated under stress testing conditions on SoC QCS404/5 - make sure we wait for a bounded amount of time. Tested on SoC QCS404. Signed-off-by: Jorge Ramirez-Ortiz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 23833ad952ba..3657a24913fc 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -383,10 +383,14 @@ no_rx: static inline void msm_wait_for_xmitr(struct uart_port *port) { + unsigned int timeout = 500000; + while (!(msm_read(port, UART_SR) & UART_SR_TX_EMPTY)) { if (msm_read(port, UART_ISR) & UART_ISR_TX_READY) break; udelay(1); + if (!timeout--) + break; } msm_write(port, UART_CR_CMD_RESET_TX_READY, UART_CR); }