On Mon, Aug 16, 2021 at 04:13:47PM +0200, Michal Kubecek wrote: > On Mon, Aug 16, 2021 at 03:26:20PM +0200, Greg Kroah-Hartman wrote: > > On Mon, Aug 16, 2021 at 03:00:59PM +0200, Michal Kubecek wrote: > > > Hello, > > > > > > starting with v5.14-rc1, my kernel log gets flooded with messages > > > > > > hid-generic 0003:051D:0002.0002: control queue full > > > > > > at rate of ~33 per second. Device 051d:0002 is an APC UPS (BR-650 VA). > > > I bisected the issue to commit > > > > > > 7652dd2c5cb7 ("USB: core: Check buffer length matches wLength for control transfers") > > > > > > Reverting this commit on top of v5.14-rc6 resolves the issue. I suspect > > > the problem is some missing cleanup when usb_submit_urb() bails out on > > > the newly added check but I'm not familiar enough with the code to see > > > what is missing or if the problem is on USB or HID side. ... > Looking at the code, the primary problem seems to be that the "else" > branch in hid_submit_ctrl() recalculates transfer_buffer_length to > a rounded up value but assigns the original length to wLength. Looks like you found the bug. Fixing it might be as simple as setting len = padlen in that "else" branch. You could then combine the transfer_buffer_length assignment with the one in the "if" branch and hoist them out after the entire "if" statement. Alan Stern