提交 c389d27b 编写于 作者: B Borislav Petkov 提交者: Linus Torvalds

8250.c: port.lock is irq-safe

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: NBorislav Petkov <petkovbb@gmail.com>
Tested-by: NIngo Molnar <mingo@elte.hu>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 5def9a3a
...@@ -1885,7 +1885,7 @@ static int serial8250_startup(struct uart_port *port) ...@@ -1885,7 +1885,7 @@ static int serial8250_startup(struct uart_port *port)
* the interrupt is enabled. Delays are necessary to * the interrupt is enabled. Delays are necessary to
* allow register changes to become visible. * 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) if (up->port.flags & UPF_SHARE_IRQ)
disable_irq_nosync(up->port.irq); disable_irq_nosync(up->port.irq);
...@@ -1901,7 +1901,7 @@ static int serial8250_startup(struct uart_port *port) ...@@ -1901,7 +1901,7 @@ static int serial8250_startup(struct uart_port *port)
if (up->port.flags & UPF_SHARE_IRQ) if (up->port.flags & UPF_SHARE_IRQ)
enable_irq(up->port.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 * If the interrupt is not reasserted, setup a timer to
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册