Skip to content

Commit

Permalink
8250.c: port.lock is irq-safe
Browse files Browse the repository at this point in the history
serial8250_startup() doesn't disable interrupts while taking the &up->port.lock
which might race against the interrupt handler serial8250_interrupt(), which
when entered, will deadlock waiting for the lock to be released.

Signed-off-by: Borislav Petkov <[email protected]>
Tested-by: Ingo Molnar <[email protected]>
Cc: Alan Cox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Borislav Petkov authored and torvalds committed Jul 30, 2008
1 parent 5def9a3 commit c389d27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/serial/8250.c
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ static int serial8250_startup(struct uart_port *port)
* the interrupt is enabled. Delays are necessary to
* allow register changes to become visible.
*/
spin_lock(&up->port.lock);
spin_lock_irqsave(&up->port.lock, flags);
if (up->port.flags & UPF_SHARE_IRQ)
disable_irq_nosync(up->port.irq);

Expand All @@ -1901,7 +1901,7 @@ static int serial8250_startup(struct uart_port *port)

if (up->port.flags & UPF_SHARE_IRQ)
enable_irq(up->port.irq);
spin_unlock(&up->port.lock);
spin_unlock_irqrestore(&up->port.lock, flags);

/*
* If the interrupt is not reasserted, setup a timer to
Expand Down

0 comments on commit c389d27

Please sign in to comment.