OSDN Git Service

USB: serial: ch341: fix control-message error handling
authorJohan Hovold <johan@kernel.org>
Fri, 6 Jan 2017 18:15:18 +0000 (19:15 +0100)
committerJohan Hovold <johan@kernel.org>
Wed, 11 Jan 2017 11:08:57 +0000 (12:08 +0100)
commit2d5a9c72d0c4ac73cf97f4b7814ed6c44b1e49ae
tree212f96bdaa6e7612082a3d02d8506ec656364f70
parent146cc8a17a3b4996f6805ee5c080e7101277c410
USB: serial: ch341: fix control-message error handling

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")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ch341.c