public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: "Cory T. Tusar" <ctusar@videon-central.com>
Cc: linux-kernel@vger.kernel.org, jirislaby@gmail.com,
	alan@lxorguk.ukuu.org.uk, akpm@linux-foundation.org,
	torvalds@linux-foundation.org
Subject: Re: [PATCH] tty: Fix logic change introduced by wait_event_interruptible_timeout()
Date: Sun, 23 Dec 2007 14:41:24 +0100	[thread overview]
Message-ID: <476E6584.9030304@gmail.com> (raw)
In-Reply-To: <476AE109.5070005@videon-central.com>

On 12/20/2007 10:39 PM, Cory T. Tusar wrote:
> tty: Fix logic change introduced by wait_event_interruptible_timeout()
> 
> Commit 5a52bd4a2dcb570333ce6fe2e16cd311650dbdc8 introduced a subtle logic
> change in tty_wait_until_sent().  The original version would only error
> out of the 'do { ... } while (timeout)' loop if signal_pending() evaluated
> to true; a timeout or break due to an empty buffer would fall out of the
> loop and into the tty->driver->wait_until_sent handling.  The current
> implementation will error out on either a pending signal or an empty
> buffer, falling through to the tty->driver->wait_until_sent handling
> only on a timeout.
> 
> This change reverts the logic flow in tty_wait_until_sent() to match that
> prior to the aforementioned commit.
> 
> Signed-off-by: Cory T. Tusar <ctusar@videon-central.com>

Acked-by: Jiri Slaby <jirislaby@gmail.com>

> 
> ---
> Please CC me on any replies; I'm not subscribed to lkml.  Thanks.
> 
>  drivers/char/tty_ioctl.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
> index 1bdd2bf..e02d592 100644
> --- a/drivers/char/tty_ioctl.c
> +++ b/drivers/char/tty_ioctl.c
> @@ -62,7 +62,7 @@ void tty_wait_until_sent(struct tty_struct * tty, long timeout)
>  	if (!timeout)
>  		timeout = MAX_SCHEDULE_TIMEOUT;
>  	if (wait_event_interruptible_timeout(tty->write_wait,
> -			!tty->driver->chars_in_buffer(tty), timeout))
> +			!tty->driver->chars_in_buffer(tty), timeout) < 0)
>  		return;

Thanks for tracking this down.

      parent reply	other threads:[~2007-12-23 13:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 21:39 [PATCH] tty: Fix logic change introduced by wait_event_interruptible_timeout() Cory T. Tusar
2007-12-22  6:45 ` Andrew Morton
2007-12-23  3:11   ` Cory T. Tusar
2007-12-23 13:41 ` Jiri Slaby [this message]

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=476E6584.9030304@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ctusar@videon-central.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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