diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index cd1285c3bfe9..dcf5c0af7de9 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -1177,16 +1177,20 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, return retval; switch (arg) { case TCOOFF: + spin_lock_irq(&tty->flow_lock); if (!tty->flow_stopped) { tty->flow_stopped = 1; - stop_tty(tty); + __stop_tty(tty); } + spin_unlock_irq(&tty->flow_lock); break; case TCOON: + spin_lock_irq(&tty->flow_lock); if (tty->flow_stopped) { tty->flow_stopped = 0; - start_tty(tty); + __start_tty(tty); } + spin_unlock_irq(&tty->flow_lock); break; case TCIOFF: if (STOP_CHAR(tty) != __DISABLED_CHAR) diff --git a/include/linux/tty.h b/include/linux/tty.h index fd4148d3a261..d80b53642f2c 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -262,8 +262,9 @@ struct tty_struct { unsigned long flags; int count; struct winsize winsize; /* winsize_mutex */ - int stopped; /* flow_lock */ - int flow_stopped; + unsigned long stopped:1, /* flow_lock */ + flow_stopped:1, + unused:62; int hw_stopped; int packet; unsigned char ctrl_status; /* ctrl_lock */