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 9562A64CFE; Tue, 23 Jan 2024 01:01:50 +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=1705971710; cv=none; b=Siu3SmgbPZTUMtaociICBZKOgdwQ43uHiIy4xk4OCflVM7mRUPO0+hmv2ix1zvJ4nyLDHwAOafApCbl/kkPtZoVib0QjK6oV5Y/z4dg2VxjqOSae2z/7CFWeoF8RGr8WN2BE0aeGWSvPKeG7It0FyYTCVOPjJZQwGhWGSnDiTxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971710; c=relaxed/simple; bh=DqAzCTJNdoSYtx29iaH/OZ2uE95Xp6FFehnZBA+JClQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BJdRaipcPh6sPaJkiNv8a4O142rupkKA/WDGnQTypqyiR9AeN1DF4pEI0KLdpHeSlVQ1PMSyNxOa5xa25j00jHlpmYRUnDwFOFO4s2QPR38ZKqNWCaaX69vBjvG+k6/HeNI1cxCY0k8marJw2ntyq+j4VBQw0I4EYJ0+yyuKDXU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lfKcKiMs; 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="lfKcKiMs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAAFCC433F1; Tue, 23 Jan 2024 01:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705971710; bh=DqAzCTJNdoSYtx29iaH/OZ2uE95Xp6FFehnZBA+JClQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lfKcKiMs+t7wQLDUlQEaxbHfi+fxddCIDG16m9gG1j4ko+IxxBrbnHZZx1kKkQQ4V cFWKmxz/V+B9LBVmBQ1oUeBZzf195TZt9iwOFONz6qFYvomBK99TR9aDER54/E1DM5 2IStRSdVuKq23GOLfu2ajukaajyUZ+mQSz3cVT7A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Uttkarsh Aggarwal Subject: [PATCH 5.10 212/286] usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart Date: Mon, 22 Jan 2024 15:58:38 -0800 Message-ID: <20240122235740.256870168@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235732.009174833@linuxfoundation.org> References: <20240122235732.009174833@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-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 @@ static void dwc3_ep0_stall_and_restart(s 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->ep0state = EP0_SETUP_PHASE;