Commit 6aea78a6 authored by Johan Hovold's avatar Johan Hovold Committed by Ben Hutchings

USB: serial: ftdi_sio: fix latency-timer error handling

commit e3e574ad 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: 1da177e4 ("Linux-2.6.12-rc2")
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent c874cde1
...@@ -1475,10 +1475,13 @@ static int read_latency_timer(struct usb_serial_port *port) ...@@ -1475,10 +1475,13 @@ static int read_latency_timer(struct usb_serial_port *port)
FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
0, priv->interface, 0, priv->interface,
buf, 1, WDR_TIMEOUT); buf, 1, WDR_TIMEOUT);
if (rv < 0) if (rv < 1) {
dev_err(&port->dev, "Unable to read latency timer: %i\n", rv); dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
else if (rv >= 0)
rv = -EIO;
} else {
priv->latency = buf[0]; priv->latency = buf[0];
}
kfree(buf); kfree(buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment