Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2472496pxj; Mon, 10 May 2021 03:57:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFuLBbUwFH+jc4OiwvJQgzCywR/XaSkmhlm8T3CLQUbGl38dtQfCP6e+wVgHufZQgI19oc X-Received: by 2002:a05:6602:114:: with SMTP id s20mr17980282iot.98.1620644251162; Mon, 10 May 2021 03:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644251; cv=none; d=google.com; s=arc-20160816; b=ACtuZW2yj4DivPy9+kKsS6TNJro+ilUgGS2cbJ45j2DFkSG+S7NHzm8HmBkjemv0HL n7TtbHluI2+jpHBXmNStfUoJIZFXD3OIzFARY9KVI8MvHKSStSJh2WSnsFAANxZsszz4 aPaSZLqzCRbxR3MTTvZ6UZxDfmmbME61EwkmLirbRKbfuPb31vq43xdnhxHMtgVBMZin EW2O2IZfAza26ZLXi7Y4RKk3Ysa4V/p1vD/WJek0ZehMQa4Hu2Anm07hlFgTcYNp8KoQ ls+egh5CYlkQfVpEfWnah+mMPkWWm7skxWi1b9Z30FGXgsKAPVo4hO+Xvt3y+9uQTtSx sSaA== 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=B0AG3sA7eBAWXl9BxP9ZCkwbsewbmvVHfx9G3TW0xU4=; b=xvLSC52ndm8pbEFyra3mm90KW0SVnbMVMDINjqSghgE4bb2mNoMyHP+QlxTr5aSR/2 UtAU8ZA15nw3q5g9kfKj60XzWvBwGG/oAc6dUQqaNYnfNnTkd/LrC0nX+yXMJtJCum6E 6t9ykLooiN0f9/wY7XmiK6mztYiYpwhnN3V7jXVup+7Mp/mb3N7aV6ys4ey0nM1BGNNv LclYwNh+dTxAuisNm3GFJns7v0QLxhu7C981qDlwtFETsuoGDizzEgf1a4wimWbbQcxn bXcUagqRV+WAOWdNPsNb3Fxw1EUZ1Y4+3jcPIn4RDd0lu0ILJUwt8whmFtIJRq5k2mpk 7wog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bxMngMWU; 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 x20si15365726jao.3.2021.05.10.03.57.19; Mon, 10 May 2021 03:57:31 -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=bxMngMWU; 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 S233948AbhEJKzj (ORCPT + 99 others); Mon, 10 May 2021 06:55:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:57152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232793AbhEJKog (ORCPT ); Mon, 10 May 2021 06:44:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E7E961988; Mon, 10 May 2021 10:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642822; bh=KqrtwADJFNLccYKBQbyAelZdQv0NXjhVMJ5uSbf8zRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bxMngMWU5r4YMwrlVurLHnVZ4JMORgStMJlxRMZ9sH42gZZ84yxzJSCgs9R25IeQK KRUdxMMope1Vmi+7KEdLMRFJaEnfcf3p6XDLk4qS7OcmuQHDThkKfA04zGT0Z+jaya VBbYTEDqKZ0XNA6Ljc2x4JeR1mSOHgfaNmjHL00I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wesley Cheng , Sasha Levin Subject: [PATCH 5.10 065/299] usb: dwc3: gadget: Ignore EP queue requests during bus reset Date: Mon, 10 May 2021 12:17:42 +0200 Message-Id: <20210510102007.040976375@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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 65ff41e3a18e..5b5520286eff 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3267,6 +3267,15 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) { u32 reg; + /* + * 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