]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: dwc3: ep0: Don't reset resource alloc flag (including ep0)
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Thu, 15 Aug 2024 06:40:29 +0000 (08:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Aug 2024 09:34:10 +0000 (17:34 +0800)
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.

Commit f2e0eee47038 ("usb: dwc3: ep0: Don't reset resource alloc flag")
was fixing the initial issue, but did this only for physical ep1. Since
the function dwc3_ep0_stall_and_restart is resetting the flags for both
physical endpoints, this also has to be done for ep0.

Cc: stable@vger.kernel.org
Fixes: b311048c174d ("usb: dwc3: gadget: Rewrite endpoint allocation flow")
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20240814-dwc3hwep0reset-v2-1-29e1d7d923ea@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/ep0.c

index d96ffbe520397ad1a66ff661a01530ce017de9f3..c9533a99e47c89d61f4c06609680e91a5320600f 100644 (file)
@@ -232,7 +232,8 @@ void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
        /* stall is always issued on EP0 */
        dep = dwc->eps[0];
        __dwc3_gadget_ep_set_halt(dep, 1, false);
-       dep->flags = DWC3_EP_ENABLED;
+       dep->flags &= DWC3_EP_RESOURCE_ALLOCATED;
+       dep->flags |= DWC3_EP_ENABLED;
        dwc->delayed_status = false;
 
        if (!list_empty(&dep->pending_list)) {