Skip to content

Commit 574c8b2

Browse files
jhovoldgregkh
authored andcommitted
USB: serial: mct_u232: fix modem-status error handling
commit 36356a669eddb32917fc4b5c2b9b8bf80ede69de upstream. Make sure to detect short control-message transfers so that errors are logged when reading the modem status at open. Note that while this also avoids initialising the modem status using uninitialised heap data, these bits could not leak to user space as they are currently not used. 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 ea04bd7 commit 574c8b2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/usb/serial/mct_u232.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,12 @@ static int mct_u232_get_modem_stat(struct usb_serial_port *port,
322322
MCT_U232_GET_REQUEST_TYPE,
323323
0, 0, buf, MCT_U232_GET_MODEM_STAT_SIZE,
324324
WDR_TIMEOUT);
325-
if (rc < 0) {
325+
if (rc < MCT_U232_GET_MODEM_STAT_SIZE) {
326326
dev_err(&port->dev, "Get MODEM STATus failed (error = %d)\n", rc);
327+
328+
if (rc >= 0)
329+
rc = -EIO;
330+
327331
*msr = 0;
328332
} else {
329333
*msr = buf[0];

0 commit comments

Comments
 (0)