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:18:01 +0000 (20:18 +0100)
commit3ed1f6da3a179cde1ccb3d72fe8a0f1d169f9800
treeec5e7a99540031ef8dadc36e12472e2071e9aaba
parent139556a98511929d0354389e5017d599dedf9498
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