From: Johan Hovold Date: Wed, 9 Oct 2013 15:01:09 +0000 (+0200) Subject: USB: mos7840: fix tiocmget error handling X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7471b5f424c444727014ec6a72b6008e62fafef4;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git USB: mos7840: fix tiocmget error handling commit a91ccd26e75235d86248d018fe3779732bcafd8d upstream. Make sure to return errors from tiocmget rather than rely on uninitialised stack data. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 2c1749da1f7..8b3d0abe7e1 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -1593,7 +1593,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)