Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bc76e6b authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc3: Add boundary check while traversing the TRB ring buffer"

parents 250a3511 694dfaa2
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1644,6 +1644,7 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *req)
{
	int i;
	struct dwc3_trb *trb = req->trb;

	/*
	 * If request was already started, this means we had to
@@ -1656,11 +1657,11 @@ static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *r
	 * pointer.
	 */
	for (i = 0; i < req->num_trbs; i++) {
		struct dwc3_trb *trb;

		trb = req->trb + i;
		trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
		dwc3_ep_inc_deq(dep);
		trb++;
		if (trb->ctrl & DWC3_TRBCTL_LINK_TRB)
			trb = dep->trb_pool;
	}

	req->num_trbs = 0;