FAILED: patch "[PATCH] usb: dwc3: gadget: Reject requests to a disabled endpoint" failed to apply to 5.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 5eb11b1647b0534b3a61a21473d77ebf4ffbed7c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026112500-sabotage-racing-0864@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 5eb11b1647b0534b3a61a21473d77ebf4ffbed7c Mon Sep 17 00:00:00 2001
From: Thinh Nguyen <[email protected]>
Date: Wed, 21 Oct 2026 00:37:51 +0000
Subject: [PATCH] usb: dwc3: gadget: Reject requests to a disabled endpoint
__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.
drivers/usb/dwc3/gadget.c +4 -1
@@ -1084,6 +1084,8 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) reg &= ~DWC3_DALEPENA_EP (dep->number);dwc3_writel (dwc,DWC3_DALEPENA , reg); + dep->flags &= ~DWC3_EP_ENABLED ; +dwc3_remove_requests (dwc, dep, -ESHUTDOWN ); dep->stream_capable = false;
@@ -1990,7 +1992,8 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) {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 ;
Sasha Levin
maintainerPATCH 1/1 usb: dwc3: gadget: Reject requests to a disabled endpoint
From: Thinh Nguyen <[email protected]>
[ Upstream commit 5eb11b1647b0534b3a61a21473d77ebf4ffbed7c ]
__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.
--- drivers/usb/dwc3/gadget.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +4 -1
@@ -812,6 +812,8 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) 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;
@@ -1668,7 +1670,8 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) {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_err (dwc->dev,"%s: can't queue to disabled endpoint\n" , dep->name);return -ESHUTDOWN ;
Signature · 1 line
2.53.0