Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp387651pxb; Mon, 16 Aug 2021 07:43:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC4Th07r2MW4CeV79lGPOdymk2kBzLX32L+gk0PXkJekbshYYhVsJWnFiwetkeR44TrM67 X-Received: by 2002:a5e:9610:: with SMTP id a16mr11306353ioq.57.1629125039407; Mon, 16 Aug 2021 07:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629125039; cv=none; d=google.com; s=arc-20160816; b=X9GDZ4a/a8CJAuoA2PSH9b9RaPpOEpw3lYuazlDcpaSA8zbhG8/iOmRjWkEcTzxxl4 CsbZcLnvJ8wu0FRgigUXjAkYWurWqx4xq0DFBzthIMuf/z3Hy+8maUUPqPpde1EEPonf TQiPRNwd+jqKDotxN8TUrsKirO8d/Fs9lFQGCTuWq4+XYag2LDZjsP3aem2h/OT9VtRM jM7doAAVd2m+X5VTtnmiBzVKecs1tvg3N4DRm8SZ1sj/Dqbk0T1TAvfMKx+Y/deu6J8n PerNkzwxUuKqP4d467u7OcFHR97iaPapSVoQluPQQQcclns82JYKCLJNQxCCSGRUz0DK xPDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=P+2nRPWaM3diV8kJs0c8T5/DhR0hxiFCUGMsUO6cvU0=; b=SLBvPTNiToW7ssLJ76B0DvWhkZXJJhs2paRd7yp5SBG2jy110pKzh/PWZeUolSyB/y LDPEgi8EsHK6meYLgkm4oYpWX1fDyd99TKEtVKyKkCKG4xOU3ekQfC4UDcGktEDA2JqU K51ZhgyLLfWaFmeyCWDgghyhLnqyZu69JoUZKsWiquWavpNBPs5MwY5bQ8qc3Kchp/+4 q5x39mXca1Fke3LYAoz9tJXRjRee32BRjteJretvsGjtPYmV4JbKDLIAH+c9BSymc6LN 5jk79ysy52De66IWK77RX0a9GkcOjrcX+C+f/wCR9QuB9py7R/zQ0gDRl3ApKubfY/02 SJcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si602940ila.73.2021.08.16.07.43.45; Mon, 16 Aug 2021 07:43:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232024AbhHPOj3 (ORCPT + 99 others); Mon, 16 Aug 2021 10:39:29 -0400 Received: from netrider.rowland.org ([192.131.102.5]:35401 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S230177AbhHPOj2 (ORCPT ); Mon, 16 Aug 2021 10:39:28 -0400 Received: (qmail 123046 invoked by uid 1000); 16 Aug 2021 10:38:56 -0400 Date: Mon, 16 Aug 2021 10:38:56 -0400 From: Alan Stern To: Michal Kubecek Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires Subject: Re: [REGRESSION][BISECTED] flood of "hid-generic ... control queue full" since v5.14-rc1 Message-ID: <20210816143856.GA121345@rowland.harvard.edu> References: <20210816130059.3yxtdvu2r7wo4uu3@lion.mk-sys.cz> <20210816141347.zougsudwe5tqgkpt@lion.mk-sys.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210816141347.zougsudwe5tqgkpt@lion.mk-sys.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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