summaryrefslogtreecommitdiffstats
path: root/drivers/char/n_tty.c
diff options
context:
space:
mode:
authorAlan Cox2007-07-16 08:39:43 +0200
committerLinus Torvalds2007-07-16 18:05:41 +0200
commit9c1729db3e6d738f872bcb090212af00473bf666 (patch)
treebe68b99784607953fb50d9330d34c2728215be57 /drivers/char/n_tty.c
parentUDF: check for allocated memory for data of new inodes (diff)
downloadkernel-qcow2-linux-9c1729db3e6d738f872bcb090212af00473bf666.tar.gz
kernel-qcow2-linux-9c1729db3e6d738f872bcb090212af00473bf666.tar.xz
kernel-qcow2-linux-9c1729db3e6d738f872bcb090212af00473bf666.zip
Prevent an O_NDELAY writer from blocking when a tty write is blocked by the tty atomic writer mutex
Without this a tty write could block if a previous blocking tty write was in progress on the same tty and blocked by a line discipline or hardware event. Originally found and reported by Dave Johnson. Signed-off-by: Alan Cox <alan@redhat.com> Acked-by: Dave Johnson <djohnson+linux-kernel@sw.starentnetworks.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/n_tty.c')
-rw-r--r--drivers/char/n_tty.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 154f42203b05..371631f4bfb9 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1538,7 +1538,8 @@ static unsigned int normal_poll(struct tty_struct * tty, struct file * file, pol
else
tty->minimum_to_wake = 1;
}
- if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS &&
+ if (!tty_is_writelocked(tty) &&
+ tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS &&
tty->driver->write_room(tty) > 0)
mask |= POLLOUT | POLLWRNORM;
return mask;