Skip to content

Commit

Permalink
tty: serial: msm_serial: avoid system lockup condition
Browse files Browse the repository at this point in the history
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 <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jorge Ramirez-Ortiz authored and Greg Kroah-Hartman committed Jun 10, 2019
1 parent db1b5bc commit ba3684f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/tty/serial/msm_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,14 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base)

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);
}
Expand Down

0 comments on commit ba3684f

Please sign in to comment.