Skip to content

Commit f15ca92

Browse files
jhovoldgregkh
authored andcommitted
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: 1da177e ("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>
1 parent 5890ca8 commit f15ca92

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/usb/serial/ftdi_sio.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,10 +1439,13 @@ static int read_latency_timer(struct usb_serial_port *port)
14391439
FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
14401440
0, priv->interface,
14411441
buf, 1, WDR_TIMEOUT);
1442-
if (rv < 0)
1442+
if (rv < 1) {
14431443
dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
1444-
else
1444+
if (rv >= 0)
1445+
rv = -EIO;
1446+
} else {
14451447
priv->latency = buf[0];
1448+
}
14461449

14471450
kfree(buf);
14481451

0 commit comments

Comments
 (0)