Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305473

[PATCH v2 5/7] n_tty: Fix stuck write wakeup

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject [PATCH v2 5/7] n_tty: Fix stuck write wakeup
Date 2016-01-10 06:50 +0100
Message-ID <qPh33-8nj-7@gated-at.bofh.it> (permalink)
References <qF0Gd-8bC-3@gated-at.bofh.it> <qPh33-8nj-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If signal-driven i/o is disabled while write wakeup is pending (ie.,
n_tty_write() has set TTY_DO_WRITE_WAKEUP but then signal-driven i/o
is disabled), the TTY_DO_WRITE_WAKEUP bit will never be cleared and
will cause tty_wakeup() to always call n_tty_write_wakeup.

Unconditionally clear the write wakeup, and since kill_fasync()
already checks if the fasync ptr is null, call kill_fasync()
unconditionally as well.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/n_tty.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index a93e4c7..086fd99 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -228,8 +228,8 @@ static ssize_t chars_in_buffer(struct tty_struct *tty)
 
 static void n_tty_write_wakeup(struct tty_struct *tty)
 {
-	if (tty->fasync && test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags))
-		kill_fasync(&tty->fasync, SIGIO, POLL_OUT);
+	clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
+	kill_fasync(&tty->fasync, SIGIO, POLL_OUT);
 }
 
 static void n_tty_check_throttle(struct tty_struct *tty)
-- 
2.7.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/7] More n_tty fixes Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 06:50 +0100
  [PATCH v2 2/7] tty, n_tty: Remove fasync() ldisc notification Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 06:50 +0100
  [PATCH v2 5/7] n_tty: Fix stuck write wakeup Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 06:50 +0100
  [PATCH v2 3/7] tty: Add fasync() hung up file operation Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 06:50 +0100
  [PATCH v2 6/7] n_tty: Remove tty count checks from unthrottle Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 06:50 +0100
  [PATCH v2 4/7] tty: Fix ioctl(FIOASYNC) on hungup file Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 06:50 +0100
  [PATCH v2 7/7] tty: n_tty: fix SIGIO for output Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 06:50 +0100

csiph-web