Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2105415lkv; Thu, 20 May 2021 03:32:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw///pz+9oxryaoDBTRg41yGFHNJpdQq9pm9D+qEv5bcngFBTOo8fpplJ48Svx14aUKt3Pm X-Received: by 2002:a92:360e:: with SMTP id d14mr4309266ila.106.1621506731709; Thu, 20 May 2021 03:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621506731; cv=none; d=google.com; s=arc-20160816; b=CKPlq2e/baOqjagULkoEW/sD/g6v1XOA+xjjw11l1KWhZZTx86GFsrYY2jdNEG5WjI GSTWY9x98its7vowLCKoSPuyYcjHsXSQrzKBatS/3eoqyZGHnuNcZtXLkcniXbboVlNF ZSbWwjjOvLfTTXDiLwecPvjL5YogPMdhzz1co7H6kv1najazqNaQKOTcqcGfS2QzqHIW TFUeEf+Wc1tryIbplq4VM9Yan/IU+1Uvuf/4d6inuuRq5hcyS3gkjBfOLEuAr6LieRdT ivFuWVEVJO+y+8CUHi2rdsT42qFZ+l8Cj5nXCjcYm67lEVEZw4P8YBVcCv8qtXyOWmSJ xa4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6B1xMO8c3WgQhgUW4pcQhYmJPsL0WJYj/FxXQM34NYc=; b=x4VPSt0ZoqFv9TX0wFvLzpAJFr0f9czTteKLcd3BMH17gEJ8PXAoG7VDr92L5Cwbja HOG85y55PpGN3t2jgFmngj6ZD8nI8mE91Lg+AGOiXurWOEzLVmHFKzAsvafGwewmGCtQ F49ANDdxQaSpxLltJG7QYNVNs9D6SvLYrJfYMf2R5Hg780NAnQgXOpNwY35Z8F8iUvGz G+uwU5Xm/rNOs4QZb29iPQlfh87J/QLH/SWTUqzxP3VzpCtNU0wxF1oAnAuRqY3dDmJN ur8njKLwDy/0Vru+n+ftLq98KrX4hb8wwurs+1rgh/Nyu+EGROlAFEg50ycCItz3rxo8 zuxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ET9cbwNl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si2220431ilq.106.2021.05.20.03.31.58; Thu, 20 May 2021 03:32:11 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ET9cbwNl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237085AbhETK3h (ORCPT + 99 others); Thu, 20 May 2021 06:29:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:47610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235797AbhETKRQ (ORCPT ); Thu, 20 May 2021 06:17:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 39F08613D4; Thu, 20 May 2021 09:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503965; bh=K4VxfRdlHMv/KHvkR1/3xCGjraQQ5uaFcWEMcRL0Jsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ET9cbwNlDf8zbQDW1VpZdZy0eK401Qnnw6NAQH1txMl5xaB5RyiIYvJ/XPQt5yPTB vB/5i4bHwKDcWWMX97r/jghGpBU5rjjFu7aixbWkHJqbH7xJf4GH9OoNvd2NvvFp1D rZuInnreMpfQUtCwYn4pi/c6psmw+PyNtqAQL0IU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wesley Cheng , Sasha Levin Subject: [PATCH 4.14 034/323] usb: dwc3: gadget: Ignore EP queue requests during bus reset Date: Thu, 20 May 2021 11:18:46 +0200 Message-Id: <20210520092121.278701251@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wesley Cheng [ Upstream commit 71ca43f30df9c642970f9dc9b2d6f463f4967e7b ] The current dwc3_gadget_reset_interrupt() will stop any active transfers, but only addresses blocking of EP queuing for while we are coming from a disconnected scenario, i.e. after receiving the disconnect event. If the host decides to issue a bus reset on the device, the connected parameter will still be set to true, allowing for EP queuing to continue while we are disabling the functions. To avoid this, set the connected flag to false until the stop active transfers is complete. Signed-off-by: Wesley Cheng Link: https://lore.kernel.org/r/1616146285-19149-3-git-send-email-wcheng@codeaurora.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/gadget.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 510ed406fb0b..909e8aafd580 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2695,6 +2695,15 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) dwc->connected = true; + /* + * Ideally, dwc3_reset_gadget() would trigger the function + * drivers to stop any active transfers through ep disable. + * However, for functions which defer ep disable, such as mass + * storage, we will need to rely on the call to stop active + * transfers here, and avoid allowing of request queuing. + */ + dwc->connected = false; + /* * WORKAROUND: DWC3 revisions <1.88a have an issue which * would cause a missing Disconnect Event if there's a -- 2.30.2