tty: serial: fsl_lpuart: lock port on console write
authorStefan Agner <stefan@agner.ch>
Fri, 24 Mar 2017 18:33:46 +0000 (11:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 Mar 2017 14:56:10 +0000 (16:56 +0200)
commitabf1e0a98083fd0a1069ce68ad8c92bfb97a57db
tree5ee282585208c57515e049d221f7c975394c9720
parent4d9d7d896d77e70e6868cfe681e7fcd58dc9526d
tty: serial: fsl_lpuart: lock port on console write

The console write code is not entirely race free (e.g. the operations
to disabling the UART interrupts are not atomic) hence locking is
required. This has been become apparent with the PREEMPT RT patchset
applied: With the fully preemptible kernel configuration the system
often ended up in a freeze already at startup.

Disable interrupts and lock using read_lock_irqsave. Try to lock in
the sysrq/oops case, but don't bother if locking fails.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c