From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385699; b=SbFZO/Tr1W3zQe53D2bGyHMXhdX3OhvYjhud4bSQIF+ubrU+1yvim3m0/OY42LnVquvv LLT2vH0lAFRMFEXnEkQOWHN9SusKAMm+Y9w43+kscImk9W831o+qJSKqRtJSRf7BEcPOL qdYy6YAOd83E9oYIRto2X530dRtHwXITdEJnDITJ7UCbPpUlWTqrSbm3QUacaDZdpVcfW ZR+kyQQcLDHDx1YftZKGpz17l+UIqaa13HQLe9vMCUlsSF8uIeCgKe68pMcSIz7254zUb qcserMOz7QMcU0ysp4wO+c21yGUmNrVN2l9dkYtMegf7g9ehK4O9dW/g53afgPOZoAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385699; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=pQ9AcZwP31wvxMTyTREwzhr5Af3BFv0cg65kYga3zRk=; b=12YqyHYJq/k9P7Dnh7NcTbZazqmaGymrynbw782aOnmx8Zn8LO8Yf8TNIryhUTjNFJVl Gc+WGFZBKnSvJrj1vhvmqIVyNkuh0vjHDtJrxOtwWMUlnZ6ij0OllBWVhJ/fREpcSrjBw Ru+G8YKor05Edvzsfrpmvr1Cx/rlE1RzchhMPGH5jRFbdA9PHxksfGnbO14gHSKEI0moL 1LhqZzKgSxJYu3fft2X2RGqDba5ozrKuPmBdKLK9Ic2kkafFQPe8dsuIV/GkfEa3FzqSi ihwun3MWChWDjM1bogy9wPQELK7z9E8B1sYW7EG2N2pgGAqE3H2bDuDSfRDSjHAH7aQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=sH27Z2WU; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3402B606A322; Fri, 4 Dec 2026 12:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=sH27Z2WU Received: by smtp.kernel.org (Postfix) with ESMTPSA id A65F21F0092C; Fri, 4 Dec 2026 12:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385699; bh=pQ9AcZwP31wvxMTyTREwzhr5Af3BFv0cg65kYga3zRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sH27Z2WUhDim22sd2vcr5UWepAILyhYD2qbhfnRdRKyaTKj072/Ry7Q3gWb2EohcT W2kVC1kNQTRrwaLc6qP5+HfhLegtW9wU+qHj6WBmIoURzjABvrzD/KUh+ToJOXOwtO Y4gSS0HwoG/a8UMFIohqmwxkvlMZ7uSmjvvb30yY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Selvarasu Ganesan , Thinh Nguyen Subject: [PATCH 6.6 0657/1167] usb: dwc3: gadget: Track a timed out End Transfer Date: Fri, 4 Dec 2026 19:01:24 +0900 Message-ID: <20261204100719.169154365@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thinh Nguyen commit af91c6322e633504aa45de278f5d520f39d127be upstream. If an End Transfer command with CMDIOC times out, the driver clears the resource index but keeps DWC3_EP_TRANSFER_STARTED without setting DWC3_EP_END_TRANSFER_PENDING. The command is still outstanding, but a later stop issues another End Transfer with resource index 0, and the next Start Transfer fails with "No Resource". Mark the timed out End Transfer as pending so that no other command is issued to the endpoint until it completes. For any other failure, there is no outstanding command, so clear DWC3_EP_TRANSFER_STARTED. Fixes: e192cc7b5239 ("usb: dwc3: gadget: move cmd_endtransfer to extra function") Cc: stable Reported-by: Selvarasu Ganesan Closes: https://lore.kernel.org/linux-usb/3fdda532-8181-48e9-b58d-cad7289408e7@samsung.com/ Signed-off-by: Thinh Nguyen Link: https://patch.msgid.link/5815c41a7e7923edb114741f29697cf0161f523c.1792542945.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1797,9 +1797,9 @@ static int __dwc3_stop_active_transfer(s dep->resource_index = 0; - if (!interrupt) + if (!interrupt || (ret && ret != -ETIMEDOUT)) dep->flags &= ~DWC3_EP_TRANSFER_STARTED; - else if (!ret) + else dep->flags |= DWC3_EP_END_TRANSFER_PENDING; dep->flags &= ~DWC3_EP_DELAY_STOP;