linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>, Samuel Ortiz <samuel@sortiz.org>,
	"David S. Miller" <davem@davemloft.net>,
	Alan Cox <alan@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-serial@vger.kernel.org, netdev@vger.kernel.org,
	ZIV-Asier Llano Palacios <asier.llano@cgglobal.com>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH 4/5] TTY: fix tty_wait_until_sent on 64-bit machines
Date: Thu, 05 Mar 2015 09:31:19 -0500	[thread overview]
Message-ID: <54F868B7.9010709@hurleysoftware.com> (raw)
In-Reply-To: <1425461947-15888-5-git-send-email-johan@kernel.org>

On 03/04/2015 04:39 AM, Johan Hovold wrote:
> Fix overflow bug in tty_wait_until_sent on 64-bit machines, where an
> infinite timeout (0) would be passed to the underlying tty-driver's
> wait_until_sent-operation as a negative timeout (-1), causing it to
> return immediately.

Wow, that is a nasty bug.

> This manifests itself for example as tcdrain() returning immediately,
> drivers not honouring the drain flags when setting terminal attributes,
> or even dropped data on close as a requested infinite closing-wait
> timeout would be ignored.
> 
> The first symptom  was reported by Asier LLANO who noted that tcdrain()
> returned prematurely when using the ftdi_sio usb-serial driver.
> 
> Fix this by passing 0 rather than MAX_SCHEDULE_TIMEOUT (LONG_MAX) to the
> underlying tty driver.
> 
> Note that the serial-core wait_until_sent-implementation is not affected
> by this bug due to a lucky chance (comparison to an unsigned maximum
> timeout), and neither is the cyclades one that had an explicit check for
> negative timeouts, but all other tty drivers appear to be affected.

Reviewed-by: Peter Hurley <peter@hurleysoftware.com>

  reply	other threads:[~2015-03-05 14:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04  9:39 [PATCH 0/5] TTY: fix tty_wait_until_sent on 64-bit machines Johan Hovold
2015-03-04  9:39 ` [PATCH 1/5] net: irda: fix wait_until_sent poll timeout Johan Hovold
2015-03-04  9:39 ` [PATCH 2/5] TTY: bfin_jtag_comm: remove incorrect wait_until_sent operation Johan Hovold
2015-03-05 14:33   ` Peter Hurley
2015-03-04  9:39 ` [PATCH 3/5] USB: serial: fix infinite wait_until_sent timeout Johan Hovold
2015-03-04  9:39 ` [PATCH 4/5] TTY: fix tty_wait_until_sent on 64-bit machines Johan Hovold
2015-03-05 14:31   ` Peter Hurley [this message]
2015-03-04  9:39 ` [PATCH 5/5] TTY: fix tty_wait_until_sent maximum timeout Johan Hovold
2015-03-05 14:32   ` Peter Hurley
2015-03-07  2:43 ` [PATCH 0/5] TTY: fix tty_wait_until_sent on 64-bit machines Greg Kroah-Hartman

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=54F868B7.9010709@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=alan@linux.intel.com \
    --cc=asier.llano@cgglobal.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=samuel@sortiz.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).