aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-06 20:28:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-06 20:28:16 -0400
commit97a7729a5c2f01faa076f38a7ec010961b456823 (patch)
treed1aaecf81d1357b5920579347e6bb894b4bfe11c /drivers/tty/n_tty.c
parent9987f76ad286887978803ece6cdcf34582279a29 (diff)
parentd0e639c9e06d44e713170031fe05fb60ebe680af (diff)
Merge 3.12-rc4 into tty-next
We want the tty fixes in this branch as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 09505ff4fb25..4e69f3bd7fd8 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2176,28 +2176,34 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
2176 2176
2177 if (!input_available_p(tty, 0)) { 2177 if (!input_available_p(tty, 0)) {
2178 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { 2178 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) {
2179 retval = -EIO; 2179 up_read(&tty->termios_rwsem);
2180 break; 2180 tty_flush_to_ldisc(tty);
2181 } 2181 down_read(&tty->termios_rwsem);
2182 if (tty_hung_up_p(file)) 2182 if (!input_available_p(tty, 0)) {
2183 break; 2183 retval = -EIO;
2184 if (!timeout) 2184 break;
2185 break; 2185 }
2186 if (file->f_flags & O_NONBLOCK) { 2186 } else {
2187 retval = -EAGAIN; 2187 if (tty_hung_up_p(file))
2188 break; 2188 break;
2189 } 2189 if (!timeout)
2190 if (signal_pending(current)) { 2190 break;
2191 retval = -ERESTARTSYS; 2191 if (file->f_flags & O_NONBLOCK) {
2192 break; 2192 retval = -EAGAIN;
2193 } 2193 break;
2194 n_tty_set_room(tty); 2194 }
2195 up_read(&tty->termios_rwsem); 2195 if (signal_pending(current)) {
2196 retval = -ERESTARTSYS;
2197 break;
2198 }
2199 n_tty_set_room(tty);
2200 up_read(&tty->termios_rwsem);
2196 2201
2197 timeout = schedule_timeout(timeout); 2202 timeout = schedule_timeout(timeout);
2198 2203
2199 down_read(&tty->termios_rwsem); 2204 down_read(&tty->termios_rwsem);
2200 continue; 2205 continue;
2206 }
2201 } 2207 }
2202 __set_current_state(TASK_RUNNING); 2208 __set_current_state(TASK_RUNNING);
2203 2209