public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org,
	Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH 5/6] n_tty: Fix stuck write wakeup
Date: Sat, 12 Dec 2015 14:16:38 -0800	[thread overview]
Message-ID: <1449958599-5533-6-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1449958599-5533-1-git-send-email-peter@hurleysoftware.com>

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 e695f8f..5034da0 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -230,8 +230,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.6.3


  parent reply	other threads:[~2015-12-12 22:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12 22:16 [PATCH 0/6] More n_tty fixes Peter Hurley
2015-12-12 22:16 ` [PATCH 1/6] n_tty: Always wake up read()/poll() if new input Peter Hurley
2015-12-13 14:49   ` Johannes Stezenbach
2015-12-13 19:53     ` Peter Hurley
2015-12-12 22:16 ` [PATCH 2/6] tty, n_tty: Remove fasync() ldisc notification Peter Hurley
2015-12-12 22:16 ` [PATCH 3/6] tty: Add fasync() hung up file operation Peter Hurley
2015-12-12 22:16 ` [PATCH 4/6] tty: Fix ioctl(FIOASYNC) on hungup file Peter Hurley
2015-12-12 22:16 ` Peter Hurley [this message]
2015-12-13 15:18   ` [PATCH 5/6] n_tty: Fix stuck write wakeup Johannes Stezenbach
2015-12-13 18:38     ` Peter Hurley
2015-12-13 19:27       ` Johannes Stezenbach
2015-12-12 22:16 ` [PATCH 6/6] n_tty: Remove tty count checks from unthrottle Peter Hurley
2016-01-10  5:45 ` [PATCH v2 0/7] More n_tty fixes Peter Hurley
2016-01-10  5:45   ` [PATCH v2 1/7] n_tty: Always wake up read()/poll() if new input Peter Hurley
2016-01-10  5:45   ` [PATCH v2 2/7] tty, n_tty: Remove fasync() ldisc notification Peter Hurley
2016-01-10  5:45   ` [PATCH v2 3/7] tty: Add fasync() hung up file operation Peter Hurley
2016-01-10  5:45   ` [PATCH v2 4/7] tty: Fix ioctl(FIOASYNC) on hungup file Peter Hurley
2016-01-10  5:45   ` [PATCH v2 5/7] n_tty: Fix stuck write wakeup Peter Hurley
2016-01-10  5:45   ` [PATCH v2 6/7] n_tty: Remove tty count checks from unthrottle Peter Hurley
2016-01-10  5:45   ` [PATCH v2 7/7] tty: n_tty: fix SIGIO for output Peter Hurley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449958599-5533-6-git-send-email-peter@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox