Skip to content

Commit

Permalink
serial: core: Claim port mutex for set_ldisc()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Nov 6, 2014
1 parent 9191aaa commit db1b9df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit db1b9df

Please sign in to comment.