Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Jiri 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jiri Kosina and committed by
Linus Torvalds
4bf3631c c5408b88

+3 -2
+3 -2
drivers/serial/8250.c
··· 1334 1334 serial8250_handle_port(struct uart_8250_port *up) 1335 1335 { 1336 1336 unsigned int status; 1337 + unsigned long flags; 1337 1338 1338 - spin_lock(&up->port.lock); 1339 + spin_lock_irqsave(&up->port.lock, flags); 1339 1340 1340 1341 status = serial_inp(up, UART_LSR); 1341 1342 ··· 1348 1347 if (status & UART_LSR_THRE) 1349 1348 transmit_chars(up); 1350 1349 1351 - spin_unlock(&up->port.lock); 1350 + spin_unlock_irqrestore(&up->port.lock, flags); 1352 1351 } 1353 1352 1354 1353 /*