# Re: \[PATCH 1/3\] HID: usbhid: Fix flood of "control queue full" messages

- From: Jiri Kosina \<jikos@kernel.org\>
- Date: 2021-09-01 18:54:37 
- List: linux-usb
- Page: https://ratatoskr.run/linux-usb/2021/09/8878704
- Thread: https://ratatoskr.run/linux-input/2021/07/1448501/t.md

```text
On Wed, 1 Sep 2021, Alan Stern wrote:

> From: Michal Kubecek <redacted>
> 
> [patch description by Alan Stern]
> 
> Commit 7652dd2c5cb7 ("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 <redacted>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Fixes: 7652dd2c5cb7 ("USB: core: Check buffer length matches wLength for control transfers")
> Tested-by: Oleksandr Natalenko <redacted>
> Tested-by: Benjamin Tissoires <redacted>
> Acked-by: Benjamin Tissoires <redacted>
> Cc: <redacted>
> 

Thanks Alan, applied and I will be sending whole HID tree to Linus soon.

(BTW, something broke your threading, so 2/3 and 3/3 were not threaded 
together with 1/3).

-- 
Jiri Kosina
SUSE Labs

```
