[PATCH Trusty SRU] n_tty: Fix poll() when TIME_CHAR and MIN_CHAR == 0
tim.gardner at canonical.com
tim.gardner at canonical.com
Tue Sep 15 13:48:55 UTC 2015
From: Peter Hurley <peter at hurleysoftware.com>
BugLink: http://bugs.launchpad.net/bugs/1397976
Commit eafbe67f84761d787802e5113d895a316b6292fe,
n_tty: Refactor input_available_p() by call site
broke poll() when TIME_CHAR(tty) and MIN_CHAR(tty) are both 0.
When TIME_CHAR and MIN_CHAR are both 0, input is available if the
read_cnt is 1 (not 0).
Reported-by: Eric Dumazet <edumazet at google.com>
Tested-by: Eric Dumazet <edumazet at google.com>
Reported-by: Stephane Eranian <eranian at google.com>
Tested-by: David Ahern <dsahern at gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme at redhat.com>
Signed-off-by: Peter Hurley <peter at hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit a5934804a834f525c9e6289935ceef65b952b101)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
It appears we didn't get all of the relevant commits. This looks good for stable as well.
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1397976/comments/4
drivers/tty/n_tty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 3480a67..84dcdf4 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1961,7 +1961,7 @@ err:
static inline int input_available_p(struct tty_struct *tty, int poll)
{
struct n_tty_data *ldata = tty->disc_data;
- int amt = poll && !TIME_CHAR(tty) ? MIN_CHAR(tty) : 1;
+ int amt = poll && !TIME_CHAR(tty) && MIN_CHAR(tty) ? MIN_CHAR(tty) : 1;
if (ldata->icanon && !L_EXTPROC(tty)) {
if (ldata->canon_head != ldata->read_tail)
--
1.9.1
More information about the kernel-team
mailing list