From: Peter Hurley Date: Wed, 5 Nov 2014 18:11:42 +0000 (-0500) Subject: serial: core: Claim port mutex for set_ldisc() X-Git-Tag: v3.19-rc1~79^2~73 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=db1b9dfcd622604b268234e01c539927093abce7;p=linux.git 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 Signed-off-by: Greg Kroah-Hartman --- 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,