Skip to content

Commit

Permalink
[SERIAL] 8250: sysrq deadlock fix
Browse files Browse the repository at this point in the history
Fix http://bugzilla.kernel.org/show_bug.cgi?id=6716

Doing a sysrq over a serial line into an SMP machine presently deadlocks.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Andrew Morton authored and Russell King committed Jul 9, 2006
1 parent 3be91ec commit 68aa2c0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/serial/8250.c
Original file line number Diff line number Diff line change
Expand Up @@ -2252,10 +2252,14 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)

touch_nmi_watchdog();

if (oops_in_progress) {
locked = spin_trylock_irqsave(&up->port.lock, flags);
local_irq_save(flags);
if (up->port.sysrq) {
/* serial8250_handle_port() already took the lock */
locked = 0;
} else if (oops_in_progress) {
locked = spin_trylock(&up->port.lock);
} else
spin_lock_irqsave(&up->port.lock, flags);
spin_lock(&up->port.lock);

/*
* First save the IER then disable the interrupts
Expand All @@ -2277,7 +2281,8 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
serial_out(up, UART_IER, ier);

if (locked)
spin_unlock_irqrestore(&up->port.lock, flags);
spin_unlock(&up->port.lock);
local_irq_restore(flags);
}

static int serial8250_console_setup(struct console *co, char *options)
Expand Down

0 comments on commit 68aa2c0

Please sign in to comment.