aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 7cdd1eb9406c..0f74945af624 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -768,7 +768,7 @@ static size_t __process_echoes(struct tty_struct *tty)
768 * data at the tail to prevent a subsequent overrun */ 768 * data at the tail to prevent a subsequent overrun */
769 while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) { 769 while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) {
770 if (echo_buf(ldata, tail) == ECHO_OP_START) { 770 if (echo_buf(ldata, tail) == ECHO_OP_START) {
771 if (echo_buf(ldata, tail) == ECHO_OP_ERASE_TAB) 771 if (echo_buf(ldata, tail + 1) == ECHO_OP_ERASE_TAB)
772 tail += 3; 772 tail += 3;
773 else 773 else
774 tail += 2; 774 tail += 2;
@@ -1998,7 +1998,10 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
1998 found = 1; 1998 found = 1;
1999 1999
2000 size = N_TTY_BUF_SIZE - tail; 2000 size = N_TTY_BUF_SIZE - tail;
2001 n = (found + eol + size) & (N_TTY_BUF_SIZE - 1); 2001 n = eol - tail;
2002 if (n > 4096)
2003 n += 4096;
2004 n += found;
2002 c = n; 2005 c = n;
2003 2006
2004 if (found && read_buf(ldata, eol) == __DISABLED_CHAR) { 2007 if (found && read_buf(ldata, eol) == __DISABLED_CHAR) {
@@ -2243,18 +2246,19 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
2243 if (time) 2246 if (time)
2244 timeout = time; 2247 timeout = time;
2245 } 2248 }
2246 mutex_unlock(&ldata->atomic_read_lock); 2249 n_tty_set_room(tty);
2247 remove_wait_queue(&tty->read_wait, &wait); 2250 up_read(&tty->termios_rwsem);
2248 2251
2252 remove_wait_queue(&tty->read_wait, &wait);
2249 if (!waitqueue_active(&tty->read_wait)) 2253 if (!waitqueue_active(&tty->read_wait))
2250 ldata->minimum_to_wake = minimum; 2254 ldata->minimum_to_wake = minimum;
2251 2255
2256 mutex_unlock(&ldata->atomic_read_lock);
2257
2252 __set_current_state(TASK_RUNNING); 2258 __set_current_state(TASK_RUNNING);
2253 if (b - buf) 2259 if (b - buf)
2254 retval = b - buf; 2260 retval = b - buf;
2255 2261
2256 n_tty_set_room(tty);
2257 up_read(&tty->termios_rwsem);
2258 return retval; 2262 return retval;
2259} 2263}
2260 2264