Skip to content

Commit

Permalink
Fix a potential issue in mpc52xx uart driver
Browse files Browse the repository at this point in the history
mpc52xx_uart_int and __uart_put_char both try to acquire the
port->lock. Therefore the function sequence of:

mpc52xx_uart_int--> ...-->flush_to_ldisc-->...-->__uart_put_char

can potentially trigger a deadlock. To avoid this deadlock a fix
similar to that found in the 8250.c serial driver is applied. The
deadlock is avoided by releasing the lock before pushing a buffer
and reacquiring it when completed.

Signed-off-by: Andrew Liu <shengping.liu@windriver.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Andrew Liu authored and Grant Likely committed May 1, 2008
1 parent 80791be commit fbe543b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/serial/mpc52xx_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,9 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
}
}

spin_unlock(&port->lock);
tty_flip_buffer_push(tty);
spin_lock(&port->lock);

return psc_ops->raw_rx_rdy(port);
}
Expand Down

0 comments on commit fbe543b

Please sign in to comment.