mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
USB: serial: ftdi_sio: fix latency-timer error handling
commite3e574ad85upstream. 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:1da177e4c3("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5890ca8333
commit
f15ca928dc
@@ -1439,10 +1439,13 @@ static int read_latency_timer(struct usb_serial_port *port)
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user