USB: serial: ch341: fix control-message error handling
authorJohan Hovold <johan@kernel.org>
Fri, 6 Jan 2017 18:15:18 +0000 (19:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jan 2017 19:17:20 +0000 (20:17 +0100)
commit802b4ef3b9898c5485ebb4185ba9131518bb9efd
tree899b6875a64b3308ec477314cb64ce518904a54d
parentbc74606d8d80c188ba1ef676a6859510b3c65bf9
USB: serial: ch341: fix control-message error handling

commit 2d5a9c72d0c4ac73cf97f4b7814ed6c44b1e49ae upstream.

A short control transfer would currently fail to be detected, something
which could lead to stale buffer data being used as valid input.

Check for short transfers, and make sure to log any transfer errors.

Note that this also avoids leaking heap data to user space (TIOCMGET)
and the remote device (break control).

Fixes: 6ce76104781a ("USB: Driver for CH341 USB-serial adaptor")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/ch341.c