diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-03-11 09:19:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-11 11:39:52 -0400 |
commit | 7fd6f640f2dd17dac6ddd6702c378cb0bb9cfa11 (patch) | |
tree | b726c53178d24d15377206bcf25362d908b1420e /drivers/tty | |
parent | 9eccca0843205f87c00404b663188b88eb248051 (diff) |
serial: 8250_dw: Fix deadlock in LCR workaround
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>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/8250/8250_dw.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 2ab229ddee38..6ae5b8560e4d 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c | |||
@@ -119,7 +119,10 @@ static void dw8250_serial_out(struct uart_port *p, int offset, int value) | |||
119 | dw8250_force_idle(p); | 119 | dw8250_force_idle(p); |
120 | writeb(value, p->membase + (UART_LCR << p->regshift)); | 120 | writeb(value, p->membase + (UART_LCR << p->regshift)); |
121 | } | 121 | } |
122 | dev_err(p->dev, "Couldn't set LCR to %d\n", value); | 122 | /* |
123 | * FIXME: this deadlocks if port->lock is already held | ||
124 | * dev_err(p->dev, "Couldn't set LCR to %d\n", value); | ||
125 | */ | ||
123 | } | 126 | } |
124 | } | 127 | } |
125 | 128 | ||
@@ -163,7 +166,10 @@ static void dw8250_serial_outq(struct uart_port *p, int offset, int value) | |||
163 | __raw_writeq(value & 0xff, | 166 | __raw_writeq(value & 0xff, |
164 | p->membase + (UART_LCR << p->regshift)); | 167 | p->membase + (UART_LCR << p->regshift)); |
165 | } | 168 | } |
166 | dev_err(p->dev, "Couldn't set LCR to %d\n", value); | 169 | /* |
170 | * FIXME: this deadlocks if port->lock is already held | ||
171 | * dev_err(p->dev, "Couldn't set LCR to %d\n", value); | ||
172 | */ | ||
167 | } | 173 | } |
168 | } | 174 | } |
169 | #endif /* CONFIG_64BIT */ | 175 | #endif /* CONFIG_64BIT */ |
@@ -187,7 +193,10 @@ static void dw8250_serial_out32(struct uart_port *p, int offset, int value) | |||
187 | dw8250_force_idle(p); | 193 | dw8250_force_idle(p); |
188 | writel(value, p->membase + (UART_LCR << p->regshift)); | 194 | writel(value, p->membase + (UART_LCR << p->regshift)); |
189 | } | 195 | } |
190 | dev_err(p->dev, "Couldn't set LCR to %d\n", value); | 196 | /* |
197 | * FIXME: this deadlocks if port->lock is already held | ||
198 | * dev_err(p->dev, "Couldn't set LCR to %d\n", value); | ||
199 | */ | ||
191 | } | 200 | } |
192 | } | 201 | } |
193 | 202 | ||