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

Commit dd073e3b authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: dwc3: gadget: Don't queue endless req through generic ep_queue



For DBM endpoints, queueing endless request through generic ep_queue
API should not allowed. Otherwise it might lead to crash when called
dwc3_gadget_map_request(). Hence add check whether it is DBM endpoint
or not and if it is, return error.

Change-Id: I7923df35f30293ac7ebb94b656f709f4ba5e00e5
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent cfd42c3b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1421,6 +1421,17 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
		return -ESHUTDOWN;
	}

	/*
	 * Queuing endless request to USB endpoint through generic ep queue
	 * API should not be allowed.
	 */
	if (dep->endpoint.endless) {
		dev_dbg(dwc->dev, "trying to queue endless request %p to %s\n",
				request, ep->name);
		spin_unlock_irqrestore(&dwc->lock, flags);
		return -EPERM;
	}

	if (dwc3_gadget_is_suspended(dwc)) {
		if (dwc->gadget.remote_wakeup)
			dwc3_gadget_wakeup(&dwc->gadget);