diff options
author | Alan Cox <alan@redhat.com> | 2007-07-16 02:39:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:41 -0400 |
commit | 9c1729db3e6d738f872bcb090212af00473bf666 (patch) | |
tree | be68b99784607953fb50d9330d34c2728215be57 /drivers/char/tty_ioctl.c | |
parent | c9c64155f5a81b4b41e98f9fb9c464a565c1bf72 (diff) |
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/tty_ioctl.c')
-rw-r--r-- | drivers/char/tty_ioctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index fd471cb3338f..918e24c885f1 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -667,7 +667,7 @@ static int send_prio_char(struct tty_struct *tty, char ch) | |||
667 | return 0; | 667 | return 0; |
668 | } | 668 | } |
669 | 669 | ||
670 | if (mutex_lock_interruptible(&tty->atomic_write_lock)) | 670 | if (tty_write_lock(tty, 0) < 0) |
671 | return -ERESTARTSYS; | 671 | return -ERESTARTSYS; |
672 | 672 | ||
673 | if (was_stopped) | 673 | if (was_stopped) |
@@ -675,7 +675,7 @@ static int send_prio_char(struct tty_struct *tty, char ch) | |||
675 | tty->driver->write(tty, &ch, 1); | 675 | tty->driver->write(tty, &ch, 1); |
676 | if (was_stopped) | 676 | if (was_stopped) |
677 | stop_tty(tty); | 677 | stop_tty(tty); |
678 | mutex_unlock(&tty->atomic_write_lock); | 678 | tty_write_unlock(tty); |
679 | return 0; | 679 | return 0; |
680 | } | 680 | } |
681 | 681 | ||