diff options
author | Johan Hovold <johan@kernel.org> | 2017-01-12 08:56:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-14 08:00:19 -0400 |
commit | 594c9b4b0acb9e3091c583958ee144b58d0e7bdd (patch) | |
tree | fb99e4b74aac66a65f02941109e9ef187e9f70ab | |
parent | ca4e6525df053f0e023195b571c9d6241197bc09 (diff) |
USB: serial: ftdi_sio: fix latency-timer error handling
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>
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 99a0a5f1b400..d8d13eede6d9 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 | ||