From: Peter Hurley Date: Thu, 7 Nov 2013 18:59:46 +0000 (-0500) Subject: n_tty: Ensure reader restarts worker for next reader X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=42458f41d08f0873299e830464c1232a6839297d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git n_tty: Ensure reader restarts worker for next reader A departing reader must restart a flush_to_ldisc() worker _before_ the next reader enters the read loop; this is to avoid the new reader concluding no more i/o is available and prematurely exiting, when the old reader simply hasn't re-started the worker yet. Cc: stable # 3.12 Signed-off-by: Peter Hurley Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 7cdd1eb9406c..a2b70c97391f 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -2243,6 +2243,9 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, if (time) timeout = time; } + n_tty_set_room(tty); + up_read(&tty->termios_rwsem); + mutex_unlock(&ldata->atomic_read_lock); remove_wait_queue(&tty->read_wait, &wait); @@ -2253,8 +2256,6 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, if (b - buf) retval = b - buf; - n_tty_set_room(tty); - up_read(&tty->termios_rwsem); return retval; }