Commit 4bf3631c authored by Jiri Kosina's avatar Jiri Kosina Committed by Linus Torvalds

8250: fix possible deadlock between serial8250_handle_port() and serial8250_interrupt()

Commit 40b36daa introduced possibility that serial8250_backup_timeout() ->
serial8250_handle_port() locks port.lock without disabling irqs, thus
allowing deadlock against interrupt handler (port.lock is acquired in
serial8250_interrupt()).

Spotted by lockdep.
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c5408b88
...@@ -1334,8 +1334,9 @@ static inline void ...@@ -1334,8 +1334,9 @@ static inline void
serial8250_handle_port(struct uart_8250_port *up) serial8250_handle_port(struct uart_8250_port *up)
{ {
unsigned int status; unsigned int status;
unsigned long flags;
spin_lock(&up->port.lock); spin_lock_irqsave(&up->port.lock, flags);
status = serial_inp(up, UART_LSR); status = serial_inp(up, UART_LSR);
...@@ -1347,7 +1348,7 @@ serial8250_handle_port(struct uart_8250_port *up) ...@@ -1347,7 +1348,7 @@ serial8250_handle_port(struct uart_8250_port *up)
if (status & UART_LSR_THRE) if (status & UART_LSR_THRE)
transmit_chars(up); transmit_chars(up);
spin_unlock(&up->port.lock); spin_unlock_irqrestore(&up->port.lock, flags);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment