]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
USB: serial: cp210x: fix tiocmget error handling
authorJohan Hovold <johan@kernel.org>
Wed, 19 Oct 2016 13:45:07 +0000 (15:45 +0200)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 6 Dec 2016 16:51:45 +0000 (16:51 +0000)
BugLink: http://bugs.launchpad.net/bugs/1642572
commit de24e0a108bc48062e1c7acaa97014bce32a919f upstream.

The current tiocmget implementation would fail to report errors up the
stack and instead leaked a few bits from the stack as a mask of
modem-status flags.

Fixes: 39a66b8d22a3 ("[PATCH] USB: CP2101 Add support for flow control")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/usb/serial/cp210x.c

index 6eccded3bc338dcb1940d42a4729d9685458a2d9..976195e748a355ee3c3d9694d4b4b21e910a7775 100644 (file)
@@ -845,7 +845,9 @@ static int cp210x_tiocmget(struct tty_struct *tty)
        unsigned int control;
        int result;
 
-       cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1);
+       result = cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1);
+       if (result)
+               return result;
 
        result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
                |((control & CONTROL_RTS) ? TIOCM_RTS : 0)