linux/drivers/tty/serial/8250
Peter Hurley 59f9384970 serial: 8250_dw: Fix deadlock in LCR workaround
commit 7fd6f640f2 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>
[ luis: backported to 3.16:
  - dropped changes to dw8250_serial_outq() ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2015-04-01 10:17:41 +01:00
..
8250.h serial: 8250: remove a few lines of dead code 2013-03-25 16:36:48 -07:00
8250_accent.c serial: group all the 8250 related code together 2012-01-24 11:23:59 -08:00
8250_acorn.c tty: remove use of __devexit 2012-11-21 15:27:46 -08:00
8250_boca.c serial: group all the 8250 related code together 2012-01-24 11:23:59 -08:00
8250_core.c serial: Fix IGNBRK handling 2014-06-19 13:04:52 -07:00
8250_dma.c serial: 8250_dma: check the result of TX buffer mapping 2014-05-28 13:07:27 -07:00
8250_dw.c serial: 8250_dw: Fix deadlock in LCR workaround 2015-04-01 10:17:41 +01:00
8250_early.c tty/serial: fix 8250 early console option passing to regular console 2014-06-19 13:07:26 -07:00
8250_em.c tty: delete non-required instances of include <linux/init.h> 2014-01-07 17:05:21 -08:00
8250_exar_st16c554.c serial: group all the 8250 related code together 2012-01-24 11:23:59 -08:00
8250_fourport.c serial: group all the 8250 related code together 2012-01-24 11:23:59 -08:00
8250_fsl.c serial: group all the 8250 related code together 2012-01-24 11:23:59 -08:00
8250_gsc.c parisc: Fix interrupt routing for C8000 serial ports 2013-07-31 23:42:32 +02:00
8250_hp300.c tty: remove use of __devexit 2012-11-21 15:27:46 -08:00
8250_hub6.c serial: group all the 8250 related code together 2012-01-24 11:23:59 -08:00
8250_pci.c Change email address for 8250_pci 2015-03-18 15:07:18 +00:00
8250_pnp.c tty: delete non-required instances of include <linux/init.h> 2014-01-07 17:05:21 -08:00
Kconfig tty/serial: convert 8250 to generic earlycon 2014-04-24 16:32:27 -07:00
Makefile TTY: 8250, revert module name change 2013-03-25 16:26:23 -07:00
serial_cs.c tty: delete non-required instances of include <linux/init.h> 2014-01-07 17:05:21 -08:00