USB: serial: ch341: fix control-message error handling
authorJohan Hovold <johan@kernel.org>
Fri, 6 Jan 2017 18:15:18 +0000 (19:15 +0100)
committerJiri Slaby <jslaby@suse.cz>
Thu, 26 Jan 2017 16:40:40 +0000 (17:40 +0100)
commit53cffccdc39a62a2cd434bb77b7457218286ebd6
treec040564b714b5cf1e1edaaa9d4d39cbd08ff84a1
parente430ae1fab3c35e53da957e7f3a5076349fbc914
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: Jiri Slaby <jslaby@suse.cz>
drivers/usb/serial/ch341.c