aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-01-12 08:56:12 -0500
committerJohan Hovold <johan@kernel.org>2017-01-16 10:38:55 -0500
commite3e574ad85a208cb179f33720bb5f12b453de33c (patch)
tree0e59dd12fad710a7eec5403a548915dd03e96cd1
parent427c3a95e3e29e65f59d99aaf320d7506f3eed57 (diff)
USB: serial: ftdi_sio: fix latency-timer error handling
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>
-rw-r--r--drivers/usb/serial/ftdi_sio.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 6dee20fc7e45..b064fad8e3ee 100644
--- 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_serial_port *port)
1439 FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, 1439 FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
1440 0, priv->interface, 1440 0, priv->interface,
1441 buf, 1, WDR_TIMEOUT); 1441 buf, 1, WDR_TIMEOUT);
1442 if (rv < 0) 1442 if (rv < 1) {
1443 dev_err(&port->dev, "Unable to read latency timer: %i\n", rv); 1443 dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
1444 else 1444 if (rv >= 0)
1445 rv = -EIO;
1446 } else {
1445 priv->latency = buf[0]; 1447 priv->latency = buf[0];
1448 }
1446 1449
1447 kfree(buf); 1450 kfree(buf);
1448 1451