From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AF1D65BDD; Tue, 23 Jan 2024 00:58:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971538; cv=none; b=MlrBl9u0T6BY0gVn1Smy3wC3k5KHeK1TgTF4XPZKMWajG/wTxvInx5j8t6q1EahruUNp/NR4X2bHzRr4cHGWV8Oh4k8ZOw9g6XJzduG2uOi843i2kiUUbL3JvO6qZR/ByMOpCcNYVrMSmsZW+SFUxgOG6yIMhxS5vQToSDfZjGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971538; c=relaxed/simple; bh=W/2ZMJZtdSFxpOIuiwciYtQ7bs4HpIktNSTpkpZREU0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B2dWELibsienByKcdLNSI1nCSWpN9LuV0HPaZurmdBarOQDQWk1brL3zgnnmIQdpfbdZrBJp1wiIPr5NTd5BSZwqwk0Axod0zV7p6e+zpV1JMyDlBoZ0qziq55lg6HYofOUybMlzgG7h8w5+01XkIbLVlYMAAgdIY5GijcNF+N8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ate4jK/k; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ate4jK/k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EB9EC433F1; Tue, 23 Jan 2024 00:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705971538; bh=W/2ZMJZtdSFxpOIuiwciYtQ7bs4HpIktNSTpkpZREU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ate4jK/k+9+TgMcNm+NCDtXnM4vWxRfRpTtpLX040BxJLHEscm9dhBN1/Oq9ePQlH sEHPqggozQBOZrCB8TEplOUDUH7OFoxUuj9oXIq0ZiLmAB4iaFX4A4Hob/ImtQcxmT n1MCZkk+Gtje+/fwJPYC8fGlJuaHLR3mukbyjKug= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Uttkarsh Aggarwal Subject: [PATCH 6.1 260/417] usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart Date: Mon, 22 Jan 2024 15:57:08 -0800 Message-ID: <20240122235800.871876726@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235751.480367507@linuxfoundation.org> References: <20240122235751.480367507@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Uttkarsh Aggarwal commit e9d40b215e38480fd94c66b06d79045717a59e9c upstream. Current implementation blocks the running operations when Plug-out and Plug-In is performed continuously, process gets stuck in dwc3_thread_interrupt(). Code Flow: CPU1 ->Gadget_start ->dwc3_interrupt ->dwc3_thread_interrupt ->dwc3_process_event_buf ->dwc3_process_event_entry ->dwc3_endpoint_interrupt ->dwc3_ep0_interrupt ->dwc3_ep0_inspect_setup ->dwc3_ep0_stall_and_restart By this time if pending_list is not empty, it will get the next request on the given list and calls dwc3_gadget_giveback which will unmap request and call its complete() callback to notify upper layers that it has completed. Currently dwc3_gadget_giveback status is set to -ECONNRESET, whereas it should be -ESHUTDOWN based on condition if not dwc->connected is true. Cc: Fixes: d742220b3577 ("usb: dwc3: ep0: giveback requests on stall_and_restart") Signed-off-by: Uttkarsh Aggarwal Link: https://lore.kernel.org/r/20231222094704.20276-1-quic_uaggarwa@quicinc.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/ep0.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -236,7 +236,10 @@ void dwc3_ep0_stall_and_restart(struct d struct dwc3_request *req; req = next_request(&dep->pending_list); - dwc3_gadget_giveback(dep, req, -ECONNRESET); + if (!dwc->connected) + dwc3_gadget_giveback(dep, req, -ESHUTDOWN); + else + dwc3_gadget_giveback(dep, req, -ECONNRESET); } dwc->eps[0]->trb_enqueue = 0;