HID: corsair: fix control-transfer error handling
authorJohan Hovold <johan@kernel.org>
Thu, 12 Jan 2017 17:17:43 +0000 (18:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Jan 2017 07:23:48 +0000 (08:23 +0100)
commit75c60df15c8579ec08fe0c840b8fa5b5a5be1155
treebac64f48dc75c23b68974c64c7aa2b89e0c6b40f
parent0f37d20fdc70ee54f002bd77ce54a2a303ad0437
HID: corsair: fix control-transfer error handling

commit 7a546af50eb78ab99840903083231eb635c8a566 upstream.

Make sure to check for short control transfers in order to avoid parsing
uninitialised buffer data and leaking it to user space.

Note that the backlight and macro-mode buffer constraints are kept as
loose as possible in order to avoid any regressions should the current
buffer sizes be larger than necessary.

Fixes: 6f78193ee9ea ("HID: corsair: Add Corsair Vengeance K90 driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-corsair.c