stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "USB: serial: ftdi_sio: fix line-status over-reporting" has been added to the 4.4-stable tree
@ 2017-02-23 20:56 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-02-23 20:56 UTC (permalink / raw)
  To: johan, gregkh, michael; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    USB: serial: ftdi_sio: fix line-status over-reporting

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-serial-ftdi_sio-fix-line-status-over-reporting.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From a6bb1e17a39818b01b55d8e6238b4b5f06d55038 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Thu, 2 Feb 2017 17:38:35 +0100
Subject: USB: serial: ftdi_sio: fix line-status over-reporting

From: Johan Hovold <johan@kernel.org>

commit a6bb1e17a39818b01b55d8e6238b4b5f06d55038 upstream.

FTDI devices use a receive latency timer to periodically empty the
receive buffer and report modem and line status (also when the buffer is
empty).

When a break or error condition is detected the corresponding status
flags will be set on a packet with nonzero data payload and the flags
are not updated until the break is over or further characters are
received.

In order to avoid over-reporting break and error conditions, these flags
must therefore only be processed for packets with payload.

This specifically fixes the case where after an overrun, the error
condition is continuously reported and NULL-characters inserted until
further data is received.

Reported-by: Michael Walle <michael@walle.cc>
Fixes: 72fda3ca6fc1 ("USB: serial: ftd_sio: implement sysrq handling on
break")
Fixes: 166ceb690750 ("USB: ftdi_sio: clean up line-status handling")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/ftdi_sio.c |   23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2070,6 +2070,20 @@ static int ftdi_process_packet(struct us
 		priv->prev_status = status;
 	}
 
+	/* save if the transmitter is empty or not */
+	if (packet[1] & FTDI_RS_TEMT)
+		priv->transmit_empty = 1;
+	else
+		priv->transmit_empty = 0;
+
+	len -= 2;
+	if (!len)
+		return 0;	/* status only */
+
+	/*
+	 * Break and error status must only be processed for packets with
+	 * data payload to avoid over-reporting.
+	 */
 	flag = TTY_NORMAL;
 	if (packet[1] & FTDI_RS_ERR_MASK) {
 		/* Break takes precedence over parity, which takes precedence
@@ -2092,15 +2106,6 @@ static int ftdi_process_packet(struct us
 		}
 	}
 
-	/* save if the transmitter is empty or not */
-	if (packet[1] & FTDI_RS_TEMT)
-		priv->transmit_empty = 1;
-	else
-		priv->transmit_empty = 0;
-
-	len -= 2;
-	if (!len)
-		return 0;	/* status only */
 	port->icount.rx += len;
 	ch = packet + 2;
 


Patches currently in stable-queue which might be from johan@kernel.org are

queue-4.4/usb-serial-ftdi_sio-fix-modem-status-error-handling.patch
queue-4.4/usb-serial-cp210x-add-new-ids-for-ge-bx50v3-boards.patch
queue-4.4/usb-serial-ark3116-fix-register-accessor-error-handling.patch
queue-4.4/usb-serial-digi_acceleport-fix-oob-data-sanity-check.patch
queue-4.4/usb-serial-ftdi_sio-fix-line-status-over-reporting.patch
queue-4.4/usb-serial-ftdi_sio-fix-extreme-low-latency-setting.patch
queue-4.4/usb-serial-spcp8x5-fix-modem-status-handling.patch
queue-4.4/usb-serial-opticon-fix-cts-retrieval-at-open.patch
queue-4.4/usb-serial-mos7840-fix-another-null-deref-at-open.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-23 20:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-23 20:56 Patch "USB: serial: ftdi_sio: fix line-status over-reporting" has been added to the 4.4-stable tree gregkh

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).