]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: dwc3: ep0: Don't reset resource alloc flag
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Tue, 16 Apr 2024 01:23:07 +0000 (01:23 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:54:55 +0000 (19:54 +0100)
commit f2e0eee4703869dc5edb5302a919861566ca7797 upstream.

The DWC3_EP_RESOURCE_ALLOCATED flag ensures that the resource of an
endpoint is only assigned once. Unless the endpoint is reset, don't
clear this flag. Otherwise we may set endpoint resource again, which
prevents the driver from initiate transfer after handling a STALL or
endpoint halt to the control endpoint.

Cc: stable@vger.kernel.org
Fixes: b311048c174d ("usb: dwc3: gadget: Rewrite endpoint allocation flow")
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/00122b7cc5be06abef461776e7cc9f5ebc8bc1cb.1713229786.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/ep0.c

index e87b37cb9a7af28c77051c816aba4bd1c1024c48..ac6b36ce1f885379119ace46fca6d813a5b6cae0 100644 (file)
@@ -224,7 +224,8 @@ void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
 
        /* reinitialize physical ep1 */
        dep = dwc->eps[1];
-       dep->flags = DWC3_EP_ENABLED;
+       dep->flags &= DWC3_EP_RESOURCE_ALLOCATED;
+       dep->flags |= DWC3_EP_ENABLED;
 
        /* stall is always issued on EP0 */
        dep = dwc->eps[0];