Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1240863pxf; Fri, 19 Mar 2021 02:33:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiBLgxTWyJAIizjFuCPJ3yCvxx0sbrac3T6K9de8rmxYgJRNL5lKBGRGtUAOqfD/1NH1iW X-Received: by 2002:a17:906:a51:: with SMTP id x17mr3276125ejf.25.1616146408172; Fri, 19 Mar 2021 02:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616146408; cv=none; d=google.com; s=arc-20160816; b=NJ+HC4QuniQpexwjaI2xLjaVfunKa0RDEkKeHVIolVt09wWhQSNcM2jiJT0DIuydRG LFjXDvsnvcXm/s9vdxPIgJ5Th7j90t+YG0YocrlYRWHbXWDamuaxjessN7m8pbeUke2j M1QZIIkjdPJVsG5nZQN57LZkQ7bXigLkJajgasTOQp8SeZl6j778RC/HgSkhOUCyzIoS 1vbKtRizd+fcyJ+EfKfS5pCt4NqryHoo7gkfWK/ywU5FEZdcs6URnQPa2BYn58eB//sq U9wo96f0gPs6gFvkI4raQB0Knkn55S2ok2Rgmszglf0y56Q21AvYy2shPmEgal6CLike BniA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=RHhAckCpn9md1d5d/2k2hWaZRD22ILzbBZ7hffLWvAA=; b=WsHiQb9O1IX2mAgnckec/E7X02USoeyesdBal8CTkWke7+2Lrw+9/IQIcv1gM+jxjE 5OVZwFWichS7KDV82reQ9o5OBeEoUopB4Urw9ePzfVzHiMffhXNmIizdLYork2Obnube iFsNWNokfXXoQWlcYRsn4/6KE7eQpChCULMEJzZAPVIDtKHx1zU0q3m5bVdk51Lx7AMO kTs7YonsGmntMvjcbRrElriTbCHPgwWyNdlLN2f5tjxZi1gIDTak6KonMox4q8g6t/d1 zEsbQJxUt2+vrsaYYzg/sRTSWII8amppzSm2OmV4HhuL8bZNzsIQcw9vNxANSF026ISe KVgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="Ix6/cA0a"; 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 y8si3431540edw.487.2021.03.19.02.33.05; Fri, 19 Mar 2021 02:33:28 -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=@mg.codeaurora.org header.s=smtp header.b="Ix6/cA0a"; 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 S230040AbhCSJcG (ORCPT + 99 others); Fri, 19 Mar 2021 05:32:06 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:37383 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbhCSJbo (ORCPT ); Fri, 19 Mar 2021 05:31:44 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1616146304; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=RHhAckCpn9md1d5d/2k2hWaZRD22ILzbBZ7hffLWvAA=; b=Ix6/cA0adLzEvW7BBhv6D87XNknjinaWS559bpuS+C3QeFFr8r4BWClkOqCJBVSN8v+VXFhb ZWdGRzL7x9QxRxuM6L71QxqjSg7KhyaUKtJoo1k6d+K7GFHcZssLpeQgtLKUfQW+zaXfD7gd 7/spAvbK55VkQv7A2944eyNjwrY= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 60546f772b0e10a0baab4960 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 19 Mar 2021 09:31:35 GMT Sender: wcheng=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id D2095C4346B; Fri, 19 Mar 2021 09:31:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from wcheng-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wcheng) by smtp.codeaurora.org (Postfix) with ESMTPSA id 237FCC4346F; Fri, 19 Mar 2021 09:31:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 237FCC4346F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=wcheng@codeaurora.org From: Wesley Cheng To: balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Wesley Cheng Subject: [PATCH 2/2] usb: dwc3: gadget: Ignore EP queue requests during bus reset Date: Fri, 19 Mar 2021 02:31:25 -0700 Message-Id: <1616146285-19149-3-git-send-email-wcheng@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1616146285-19149-1-git-send-email-wcheng@codeaurora.org> References: <1616146285-19149-1-git-send-email-wcheng@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 6e14fdc..d5ed0f69 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3327,6 +3327,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 * pending Setup Packet in the FIFO. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project