mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
USB: serial: ftdi_sio: fix modem-status error handling
commit427c3a95e3upstream. Make sure to detect short responses when fetching the modem status in order to avoid parsing uninitialised buffer data and having bits of it leak to user space. Note that we still allow for short 1-byte responses. 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
4420e0f8fd
commit
f3d56f7a58
@@ -2433,8 +2433,12 @@ static int ftdi_get_modem_status(struct usb_serial_port *port,
|
||||
FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
|
||||
0, priv->interface,
|
||||
buf, len, WDR_TIMEOUT);
|
||||
if (ret < 0) {
|
||||
|
||||
/* NOTE: We allow short responses and handle that below. */
|
||||
if (ret < 1) {
|
||||
dev_err(&port->dev, "failed to get modem status: %d\n", ret);
|
||||
if (ret >= 0)
|
||||
ret = -EIO;
|
||||
ret = usb_translate_errors(ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user