]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
usb: dwc3: gadget: always unmap EP0 requests
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 20 Dec 2016 12:14:40 +0000 (14:14 +0200)
committerLuis Henriques <luis.henriques@canonical.com>
Fri, 20 Jan 2017 11:26:47 +0000 (11:26 +0000)
BugLink: http://bugs.launchpad.net/bugs/1655969
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")
Cc: <stable@vger.kernel.org>
Tested-by: Tomasz Medrek <tomaszx.medrek@intel.com>
Reported-by: Janusz Dziedzic <januszx.dziedzic@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/usb/dwc3/gadget.c

index 5ae2b7d3a74a346f023706142057f30566089992..210ff64857e1992cc62e3c3a8eed91bda1eb1ebc 100644 (file)
@@ -259,11 +259,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
        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,