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


Groups > linux.kernel > #1639663 > unrolled thread

[PATCH 4.9 063/103] USB: serial: ftdi_sio: fix latency-timer error handling

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-05-11 17:10 +0200
Last post2017-05-11 17:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.9 063/103] USB: serial: ftdi_sio: fix latency-timer error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 17:10 +0200

#1639663 — [PATCH 4.9 063/103] USB: serial: ftdi_sio: fix latency-timer error handling

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-05-11 17:10 +0200
Subject[PATCH 4.9 063/103] USB: serial: ftdi_sio: fix latency-timer error handling
Message-ID<tFXT4-7X6-23@gated-at.bofh.it>
4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit e3e574ad85a208cb179f33720bb5f12b453de33c upstream.

Make sure to detect short responses when reading the latency timer to
avoid using stale buffer data.

Note that no heap data would currently leak through sysfs as
ASYNC_LOW_LATENCY is set by default.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/ftdi_sio.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1439,10 +1439,13 @@ static int read_latency_timer(struct usb
 			     FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
 			     0, priv->interface,
 			     buf, 1, WDR_TIMEOUT);
-	if (rv < 0)
+	if (rv < 1) {
 		dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
-	else
+		if (rv >= 0)
+			rv = -EIO;
+	} else {
 		priv->latency = buf[0];
+	}
 
 	kfree(buf);
 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web