summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/serial_core.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-11-05 13:11:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 14:57:27 -0800
commitdb1b9dfcd622604b268234e01c539927093abce7 (patch)
treee9a4520f2af1b528ea865bf36f0fa2c93d7bfa6d /drivers/tty/serial/serial_core.c
parent9191aaaa82d3149767125d58b2d260a3749d9f5e (diff)
serial: core: Claim port mutex for set_ldisc()
Three UART drivers (8250, atmel & amba-pl010) enable modem status interrupts if the line discipline is changed to N_PPS. However, the uart port flags may only be safely modified while holding the port mutex. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/serial_core.c')
-rw-r--r--drivers/tty/serial/serial_core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 1a2d90fe86da..5209eaaa7225 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1245,8 +1245,11 @@ static void uart_set_ldisc(struct tty_struct *tty)
struct uart_state *state = tty->driver_data;
struct uart_port *uport = state->uart_port;
- if (uport->ops->set_ldisc)
+ if (uport->ops->set_ldisc) {
+ mutex_lock(&state->port.mutex);
uport->ops->set_ldisc(uport, tty->termios.c_line);
+ mutex_unlock(&state->port.mutex);
+ }
}
static void uart_set_termios(struct tty_struct *tty,