From: Greg Kroah-Hartman Date: Mon, 21 Dec 2015 19:06:07 +0000 (-0800) Subject: Merge 4.4-rc6 into tty-next X-Git-Tag: v4.14-rc1~4042^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=462a1196a578fc6f52c26427070a75e044bbf9b1;p=platform%2Fkernel%2Flinux-rpi.git Merge 4.4-rc6 into tty-next We want the serial/tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman --- 462a1196a578fc6f52c26427070a75e044bbf9b1 diff --cc drivers/tty/n_tty.c index f2f6425,e49c2bce..d9a5fc2 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@@ -2087,18 -2080,25 +2087,17 @@@ static int canon_copy_from_read_buf(str n = eol - tail; if (n > N_TTY_BUF_SIZE) n += N_TTY_BUF_SIZE; - n += found; - c = n; + c = n + found; - if (found && !ldata->push && read_buf(ldata, eol) == __DISABLED_CHAR) { - n--; - eof_push = !n && ldata->read_tail != ldata->line_start; + if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) { + c = min(*nr, c); + n = c; } - n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu size:%zu more:%zu\n", - __func__, eol, found, n, c, size, more); - - if (n > size) { - ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), size); - if (ret) - return -EFAULT; - ret = tty_copy_to_user(tty, *b + size, ldata->read_buf, n - size); - } else - ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), n); + n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu tail:%zu more:%zu\n", + __func__, eol, found, n, c, tail, more); + ret = tty_copy_to_user(tty, *b, tail, n); if (ret) return -EFAULT; *b += n;