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=1796388415; b=mtBn7o+zRZOvcHvrGrqTNdr7pZ/TOjhM2sIhnloNYrYDxesFSPNEsGQxDMt7SKQOL83j 0ZTfx0q6xmDoNeCrmrZ7VIF40XYf3MGrVsARgJIU77TpgJuKhA1Edp0sI9EV4HwLRXMx3 uk/ggqnZSpdPTcgCHBzopmSRCr/wyfwwyhLvfTreyoYqIRKREc6Rl98Vht4CvhBq4DSUQ rg8NLtEtL6WymRfxLjlfZhW7godu8i6NG8X47SuBVZb8L4LMML3ovGX5aeJC/TtoD5bcY J0VbqdO+uuvscg5/oEBFL0CKSUkKM13Y5X6IYbOgOOCiJFXf52L63x0FdW7nMXbgr1Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388415; 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=EzFkdmAPz+oo9Ci9eOwVNzOxvVvSex4FjQbw9jFCe3I=; b=dZZZPHopDvV1WrAHTDtG1DzYddISzopjn6Nl4jbzW8PTMpudKlbzQs0Qhh/coeU9oQEZ PwOjFeHje6/TP9zUN2cMj3v8ct0qq8SN8HKV/CMQsabUgEBrRd4aK1k1mmEmXdUG9TAjV dJUhq8kVwoqiIBIY2OLUWsstbND9kDq1DNAPLRqv2BsK856z0ao6aaZ7b02C7lezUJqY+ aUbC38jEkeDZXvXjPGpdZkpUKGJ6E7QGyw6HBfPv58VCk10jq7degkvF+Mq9KX764RN/M J/nOgsGhpY5JgyPIW/+DZ5w0F6afscgvVo7EhQwgiyk7j/3STfdBFVj/GR4Ya8JJ3HA== 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=i+MS40VE; 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 B9704606A322; Fri, 4 Dec 2026 12:46:55 +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=i+MS40VE Received: by smtp.kernel.org (Postfix) with ESMTPSA id 320371F000CE; Fri, 4 Dec 2026 12:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388415; bh=EzFkdmAPz+oo9Ci9eOwVNzOxvVvSex4FjQbw9jFCe3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=i+MS40VEH927lL/dVo+nSIp7AabO0jR/ipSIECGzu5tSsHsf1s6shQ/OpSvw3DAsa /7PIrURVKCW+CdirHWXyz+IfBBGXbkNJxdNNxOOrMRZlNNpasVCxE8ENe0UEhcfvg8 GFaMFpgd9/FA23lcSXCWcQUu4mUoQLERE0UnDQDY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Thinh Nguyen Subject: [PATCH 6.1 0604/1059] usb: dwc3: gadget: Reject requests to a disabled endpoint Date: Fri, 4 Dec 2026 19:02:15 +0900 Message-ID: <20261204100659.768436139@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thinh Nguyen commit 5eb11b1647b0534b3a61a21473d77ebf4ffbed7c upstream. __dwc3_gadget_ep_disable() releases the lock while giving back requests, and DWC3_EP_ENABLED is only cleared afterward. A function driver can queue a new request in this window, and the driver would start a transfer on an endpoint that is already disabled in hardware. Clear DWC3_EP_ENABLED before giving back the requests, and reject requests queued to an endpoint that is not enabled. Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver") Cc: stable Signed-off-by: Thinh Nguyen Link: https://patch.msgid.link/4ceab6aa5d6af0e4780f9d3a964fd5d8168a0a02.1792542945.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/gadget.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1043,6 +1043,8 @@ static int __dwc3_gadget_ep_disable(stru reg &= ~DWC3_DALEPENA_EP(dep->number); dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); + dep->flags &= ~DWC3_EP_ENABLED; + dwc3_remove_requests(dwc, dep, -ESHUTDOWN); dep->stream_capable = false; @@ -1941,7 +1943,8 @@ static int __dwc3_gadget_ep_queue(struct { struct dwc3 *dwc = dep->dwc; - if (!dep->endpoint.desc || !dwc->pullups_connected || !dwc->connected) { + if (!(dep->flags & DWC3_EP_ENABLED) || !dep->endpoint.desc || + !dwc->pullups_connected || !dwc->connected) { dev_dbg(dwc->dev, "%s: can't queue to disabled endpoint\n", dep->name); return -ESHUTDOWN;