|
@@ -436,7 +436,7 @@ uart_get_divisor(struct uart_port *port, unsigned int baud)
|
|
|
|
|
|
EXPORT_SYMBOL(uart_get_divisor);
|
|
|
|
|
|
-/* FIXME: Consistent locking policy */
|
|
|
+/* Caller holds port mutex */
|
|
|
static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
|
|
|
struct ktermios *old_termios)
|
|
|
{
|
|
@@ -1173,11 +1173,15 @@ uart_ioctl(struct tty_struct *tty, unsigned int cmd,
|
|
|
break;
|
|
|
|
|
|
case TIOCSSERIAL:
|
|
|
+ down_write(&tty->termios_rwsem);
|
|
|
ret = uart_set_info_user(tty, state, uarg);
|
|
|
+ up_write(&tty->termios_rwsem);
|
|
|
break;
|
|
|
|
|
|
case TIOCSERCONFIG:
|
|
|
+ down_write(&tty->termios_rwsem);
|
|
|
ret = uart_do_autoconfig(tty, state);
|
|
|
+ up_write(&tty->termios_rwsem);
|
|
|
break;
|
|
|
|
|
|
case TIOCSERGWILD: /* obsolete */
|
|
@@ -1278,7 +1282,9 @@ static void uart_set_termios(struct tty_struct *tty,
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ mutex_lock(&state->port.mutex);
|
|
|
uart_change_speed(tty, state, old_termios);
|
|
|
+ mutex_unlock(&state->port.mutex);
|
|
|
/* reload cflag from termios; port driver may have overriden flags */
|
|
|
cflag = tty->termios.c_cflag;
|
|
|
|