]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
serial: core: Claim port mutex for set_ldisc()
authorPeter Hurley <peter@hurleysoftware.com>
Wed, 5 Nov 2014 18:11:42 +0000 (13:11 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 22:57:27 +0000 (14:57 -0800)
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>
drivers/tty/serial/serial_core.c

index 1a2d90fe86dac987018ce9ad690e745bd1551503..5209eaaa72253312ab7180c300322a930c56f350 100644 (file)
@@ -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,