mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
USB: serial: mct_u232: fix modem-status error handling
commit36356a669eupstream. 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: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
e17c48c328
commit
62b8b773eb
@@ -322,8 +322,12 @@ static int mct_u232_get_modem_stat(struct usb_serial_port *port,
|
||||
MCT_U232_GET_REQUEST_TYPE,
|
||||
0, 0, buf, MCT_U232_GET_MODEM_STAT_SIZE,
|
||||
WDR_TIMEOUT);
|
||||
if (rc < 0) {
|
||||
if (rc < MCT_U232_GET_MODEM_STAT_SIZE) {
|
||||
dev_err(&port->dev, "Get MODEM STATus failed (error = %d)\n", rc);
|
||||
|
||||
if (rc >= 0)
|
||||
rc = -EIO;
|
||||
|
||||
*msr = 0;
|
||||
} else {
|
||||
*msr = buf[0];
|
||||
|
||||
Reference in New Issue
Block a user