tty: serial: fsl_lpuart: fix del_timer_sync() vs timer routine deadlock
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>
Sun, 4 Dec 2016 15:49:28 +0000 (18:49 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:51:24 +0000 (11:51 +0100)
commit54a44d54be3a7394ebea42bbffd67819e0f3f89a
treec0ea4f537ae797ba0354d0b7eefa5662c8d81591
parent623ac1d4a52f279d9379bae61ae1eb37c5767f96
tty: serial: fsl_lpuart: fix del_timer_sync() vs timer routine deadlock

Problem found via lockdep:

- lpuart_set_termios() calls del_timer_sync(&sport->lpuart_timer) while
  holding sport->port.lock

- sport->lpuart_timer routine is lpuart_timer_func() that calls
  lpuart_copy_rx_to_tty() that acquires same lock.

To fix, move Rx DMA stopping out of lock, as it already is in other places
in the same file.

While at it, also make Rx DMA start/stop code to look the same is in
other places in the same file.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Tested-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c