]> git.ipfire.org Git - people/arne_f/kernel.git/commit
USB: serial: ch341: fix type promotion bug in ch341_control_in()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 4 Jul 2018 09:29:38 +0000 (12:29 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jul 2018 09:39:25 +0000 (11:39 +0200)
commit7ce4add980f54c2ef1fe4eca4136493200292793
tree36c313b4d2a577152681e8847d704c6e1e9d7f1e
parent1fb3563fac7efaf0f2b8796f9f595b3209a79db9
USB: serial: ch341: fix type promotion bug in ch341_control_in()

commit e33eab9ded328ccc14308afa51b5be7cbe78d30b upstream.

The "r" variable is an int and "bufsize" is an unsigned int so the
comparison is type promoted to unsigned.  If usb_control_msg() returns a
negative that is treated as a high positive value and the error handling
doesn't work.

Fixes: 2d5a9c72d0c4 ("USB: serial: ch341: fix control-message error handling")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/ch341.c