Commit 770b8453 authored by Martin Kögler's avatar Martin Kögler Committed by Linus Torvalds

[PATCH] serial: fix low-latency mode deadlock

We presently deadlock in low-latency mode because the receive code holds
port.lock while calling into the tty code to perform echoing.  The tty code
calls back into the driver, which then takes port.lock.

Fix that by dropping the lock around the echo call.
Acked-by: default avatarRussell King <rmk@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c835cd92
...@@ -987,8 +987,11 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) ...@@ -987,8 +987,11 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
/* The following is not allowed by the tty layer and /* The following is not allowed by the tty layer and
unsafe. It should be fixed ASAP */ unsafe. It should be fixed ASAP */
if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
if(tty->low_latency) if (tty->low_latency) {
spin_unlock(&up->port.lock);
tty_flip_buffer_push(tty); tty_flip_buffer_push(tty);
spin_lock(&up->port.lock);
}
/* If this failed then we will throw away the /* If this failed then we will throw away the
bytes but must do so to clear interrupts */ bytes but must do so to clear interrupts */
} }
...@@ -1059,7 +1062,9 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) ...@@ -1059,7 +1062,9 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
ignore_char: ignore_char:
lsr = serial_inp(up, UART_LSR); lsr = serial_inp(up, UART_LSR);
} while ((lsr & UART_LSR_DR) && (max_count-- > 0)); } while ((lsr & UART_LSR_DR) && (max_count-- > 0));
spin_unlock(&up->port.lock);
tty_flip_buffer_push(tty); tty_flip_buffer_push(tty);
spin_lock(&up->port.lock);
*status = lsr; *status = lsr;
} }
......
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