Skip to content

Commit b3fa25d

Browse files
pawellcdnsgregkh
authored andcommitted
usb: cdns3: Fix issue for clear halt endpoint
Path fixes bug which occurs during resetting endpoint in __cdns3_gadget_ep_clear_halt function. During resetting endpoint controller will change HW/DMA owned TRB. It set Abort flag in trb->control and will change trb->length field. If driver want to use the aborted trb it must update the changed field in TRB. Fixes: 7733f6c ("usb: cdns3: Add Cadence USB3 DRD Driver") cc: <stable@vger.kernel.org> Acked-by: Peter Chen <peter.chen@kernel.org> Signed-off-by: Pawel Laszczak <pawell@cadence.com> Link: https://lore.kernel.org/r/20220329084605.4022-1-pawell@cadence.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 33597f0 commit b3fa25d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/usb/cdns3/cdns3-gadget.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,6 +2684,7 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
26842684
struct usb_request *request;
26852685
struct cdns3_request *priv_req;
26862686
struct cdns3_trb *trb = NULL;
2687+
struct cdns3_trb trb_tmp;
26872688
int ret;
26882689
int val;
26892690

@@ -2693,8 +2694,10 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
26932694
if (request) {
26942695
priv_req = to_cdns3_request(request);
26952696
trb = priv_req->trb;
2696-
if (trb)
2697+
if (trb) {
2698+
trb_tmp = *trb;
26972699
trb->control = trb->control ^ cpu_to_le32(TRB_CYCLE);
2700+
}
26982701
}
26992702

27002703
writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
@@ -2709,7 +2712,7 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
27092712

27102713
if (request) {
27112714
if (trb)
2712-
trb->control = trb->control ^ cpu_to_le32(TRB_CYCLE);
2715+
*trb = trb_tmp;
27132716

27142717
cdns3_rearm_transfer(priv_ep, 1);
27152718
}

0 commit comments

Comments
 (0)