linux/drivers/hid/usbhid
Michal Kubecek 5049307d37 HID: usbhid: Fix flood of "control queue full" messages
[patch description by Alan Stern]

Commit 7652dd2c5c ("USB: core: Check buffer length matches wLength
for control transfers") causes control URB submissions to fail if the
transfer_buffer_length value disagrees with the setup packet's wLength
valuel.  Unfortunately, it turns out that the usbhid can trigger this
failure mode when it submits a control request for an input report: It
pads the transfer buffer size to a multiple of the maxpacket value but
does not increase wLength correspondingly.

These failures have caused problems for people using an APS UPC, in
the form of a flood of log messages resembling:

	hid-generic 0003:051D:0002.0002: control queue full

This patch fixes the problem by setting the wLength value equal to the
padded transfer_buffer_length value in hid_submit_ctrl().  As a nice
bonus, the code which stores the transfer_buffer_length value is now
shared between the two branches of an "if" statement, so it can be
de-duplicated.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Fixes: 7652dd2c5c ("USB: core: Check buffer length matches wLength for control transfers")
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-09-01 20:52:31 +02:00
..
hid-core.c HID: usbhid: Fix flood of "control queue full" messages 2021-09-01 20:52:31 +02:00
hid-pidff.c HID: pidff: fix error return code in hid_pidff_init() 2021-05-27 15:40:34 +02:00
hiddev.c HID: hiddev: Return specific error codes on connect failure 2021-03-08 11:12:22 +01:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile HID: core: move the dynamic quirks handling in core 2017-11-21 11:14:48 +01:00
usbhid.h Revert "HID: usbhid: do not sleep when opening device" 2020-08-18 19:54:04 +02:00
usbkbd.c HID: usbkbd: Avoid GFP_ATOMIC when GFP_KERNEL is possible 2021-06-15 10:50:36 +02:00
usbmouse.c HID: usbmouse: Avoid GFP_ATOMIC when GFP_KERNEL is possible 2021-05-26 13:11:23 +02:00