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

Commit 0b74c9aa authored by Elson Roy Serrao's avatar Elson Roy Serrao
Browse files

usb: dwc3: ep0: Fail enqueue() when racing with vbus_sess disconnect



When the setup packet comes right before the disconnect notification
there is a possible race between clearing the run stop bit and
enqueuing the setup packet. This results in controller halt failure.
Add a vbus_active check before enqueuing the packet to fix this issue.

Change-Id: I3921a1fa92a0f5c6892f1cc3ffe9dda6366b72b1
Signed-off-by: default avatarElson Roy Serrao <eserrao@codeaurora.org>
parent aae308c7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -206,7 +206,8 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
	u32				reg;

	spin_lock_irqsave(&dwc->lock, flags);
	if (!dep->endpoint.desc || !dwc->pullups_connected) {
	if (!dep->endpoint.desc || !dwc->softconnect ||
		!dwc->vbus_active) {
		dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n",
				dep->name);
		ret = -ESHUTDOWN;