Skip to contentSkip to conversation

Patch "usb: dwc3: gadget: always unmap EP0 requests" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Jan 9, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: dwc3: gadget: always unmap EP0 requests

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
usb-dwc3-gadget-always-unmap-ep0-requests.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From d62145929992f331fdde924d5963ab49588ccc7d Mon Sep 17 00:00:00 2001

From: Felipe Balbi <[email protected]>
Date: Tue, 20 Dec 2016 14:14:40 +0200
Subject: usb: dwc3: gadget: always unmap EP0 requests

From: Felipe Balbi <[email protected]>

commit d62145929992f331fdde924d5963ab49588ccc7d upstream.

commit 0416e494ce7d ("usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced") introduced a bug where we would leak DMA resources which would cause us to starve the system of them resulting in failing DMA transfers.

Fix the bug by making sure that we always unmap EP0 requests since those are *always* mapped.

Fixes 0416e494ce7d ("usb: dwc3: ep0: correct cache

sync issue in case of ep0_bounced")

---
 drivers/usb/dwc3/gadget.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc3/gadget.c +4 -4
@@ -259,11 +259,11 @@ void dwc3_gadget_giveback(struct dwc3_ep
 	if (req->request.status == -EINPROGRESS)
 		req->request.status = status;
 
-	if (dwc->ep0_bounced && dep->number == 0)
+	if (dwc->ep0_bounced && dep->number <= 1)
 		dwc->ep0_bounced = false;
-	else
-		usb_gadget_unmap_request(&dwc->gadget, &req->request,
-				req->direction);
+
+	usb_gadget_unmap_request(&dwc->gadget, &req->request,
+			req->direction);
 
 	dev_dbg(dwc->dev, "request %p from %s completed %d/%d ===> %d\n",
 			req, dep->name, req->request.actual,

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/usb-dummy-hcd-fix-bug-in-stop_activity-handle-ep0.patch queue-4.4/usb-dwc3-core-avoid-overflow-events.patch queue-4.4/usb-gadgetfs-fix-use-after-free-bug.patch queue-4.4/usb-gadget-composite-test-get_alt-presence-instead-of-set_alt.patch queue-4.4/usb-dwc3-ep0-explicitly-call-dwc3_ep0_prepare_one_trb.patch queue-4.4/usb-phy-am335x-control-fix-device-and-of_node-leaks.patch queue-4.4/usb-gadgetfs-restrict-upper-bound-on-device-configuration-size.patch queue-4.4/usb-gadgetfs-fix-checks-of-wtotallength-in-config-descriptors.patch queue-4.4/usb-dwc3-gadget-always-unmap-ep0-requests.patch queue-4.4/usb-dwc3-ep0-add-dwc3_ep0_prepare_one_trb.patch queue-4.4/usb-dwc3-pci-add-intel-gemini-lake-pci-id.patch queue-4.4/usb-gadgetfs-fix-unbounded-memory-allocation-bug.patch