serial: 8250_dw: Fix deadlock in LCR workaround
authorPeter Hurley <peter@hurleysoftware.com>
Wed, 11 Mar 2015 13:19:16 +0000 (09:19 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2015 08:33:57 +0000 (10:33 +0200)
commite3f5ff371c1e9ad273f403c6a487f972bc5bd058
treedd1dc22decda0b856c4e9c0621064e8a589d92c9
parent57a99bf7d2f467714ba9db090a2f700cb080e0d9
serial: 8250_dw: Fix deadlock in LCR workaround

commit 7fd6f640f2dd17dac6ddd6702c378cb0bb9cfa11 upstream.

Trying to write console output from within the serial console driver
while the port->lock is held causes recursive deadlock:

  CPU 0
spin_lock_irqsave(&port->lock)
printk()
  console_unlock()
    call_console_drivers()
      serial8250_console_write()
        spin_lock_irqsave(&port->lock)
** DEADLOCK **

The 8250_dw i/o accessors try to write a console error message if the
LCR workaround was unsuccessful. When the port->lock is already held
(eg., when called from serial8250_set_termios()), this deadlocks.

Make the error message a FIXME until a general solution is devised.

Cc: Tim Kryger <tim.kryger@gmail.com>
Reported-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_dw.c