serial: Take uart port lock for direct *_enable_ms()
authorPeter Hurley <peter@hurleysoftware.com>
Wed, 5 Nov 2014 18:11:44 +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) directly call their
enable_ms() method; the uart port lock must be acquired before
any h/w programming.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_core.c
drivers/tty/serial/amba-pl010.c
drivers/tty/serial/atmel_serial.c

index 116b5a75f1af3218bb8cd3ed799e9447763db55f..f0f35e782bc3e28dad618583da189d94d93c426c 100644 (file)
@@ -2613,7 +2613,9 @@ serial8250_set_ldisc(struct uart_port *port, struct ktermios *termios)
 {
        if (termios->c_line == N_PPS) {
                port->flags |= UPF_HARDPPS_CD;
+               spin_lock_irq(&port->lock);
                serial8250_enable_ms(port);
+               spin_unlock_irq(&port->lock);
        } else
                port->flags &= ~UPF_HARDPPS_CD;
 }
index 230bc7a290d5962b25fa23c3471935d0aef6de27..194108b0de84249490390f955692c7e05b81842f 100644 (file)
@@ -483,7 +483,9 @@ static void pl010_set_ldisc(struct uart_port *port, struct ktermios *termios)
 {
        if (termios->c_line == N_PPS) {
                port->flags |= UPF_HARDPPS_CD;
+               spin_lock_irq(&port->lock);
                pl010_enable_ms(port);
+               spin_unlock_irq(&port->lock);
        } else
                port->flags &= ~UPF_HARDPPS_CD;
 }
index 6a1d960e2e82a45cc29a8ef896ec779eeac6650c..e67cb38312800ed9e2b8d0f67bcd8a0f85da186c 100644 (file)
@@ -2060,7 +2060,9 @@ static void atmel_set_ldisc(struct uart_port *port, struct ktermios *termios)
 {
        if (termios->c_line == N_PPS) {
                port->flags |= UPF_HARDPPS_CD;
+               spin_lock_irq(&port->lock);
                atmel_enable_ms(port);
+               spin_unlock_irq(&port->lock);
        } else {
                port->flags &= ~UPF_HARDPPS_CD;
        }