diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-10-09 17:01:09 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-11 17:01:25 -0700 |
commit | a91ccd26e75235d86248d018fe3779732bcafd8d (patch) | |
tree | af8bcbc5090e89782c28119b09abb178e411ea9c | |
parent | 706cd17e8559c96dc883ba692c931f1ef31fbc5c (diff) |
USB: mos7840: fix tiocmget error handling
Make sure to return errors from tiocmget rather than rely on
uninitialised stack data.
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/serial/mos7840.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index fdf953539c62..e5bdd987b9e8 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -1532,7 +1532,11 @@ static int mos7840_tiocmget(struct tty_struct *tty) return -ENODEV; status = mos7840_get_uart_reg(port, MODEM_STATUS_REGISTER, &msr); + if (status != 1) + return -EIO; status = mos7840_get_uart_reg(port, MODEM_CONTROL_REGISTER, &mcr); + if (status != 1) + return -EIO; result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0) | ((mcr & MCR_RTS) ? TIOCM_RTS : 0) | ((mcr & MCR_LOOPBACK) ? TIOCM_LOOP : 0) |