usb: dwc3: core: don't forget to free coherent memory
authorFelipe Balbi <balbi@ti.com>
Fri, 8 Feb 2013 13:14:16 +0000 (15:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Mar 2013 20:10:52 +0000 (13:10 -0700)
commit d9b4330adec006c2e8907bdcacd9dcc0e8874d18 upstream.

commit 3921426 (usb: dwc3: core: move
event buffer allocation out of
dwc3_core_init()) introduced a memory leak
of the coherent memory we use as event
buffers on dwc3 driver.

If the driver is compiled as a dynamically
loadable module and use constantly loads
and unloads the driver, we will continue
to leak the coherent memory allocated during
->probe() because dwc3_free_event_buffers()
is never called during ->remove().

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/core.c

index 3a4004a620ad78bec1229d01c1dbaec04307d32d..f00c74978b7ad09ee36e9a3ff048a7465ab68a29 100644 (file)
@@ -575,6 +575,7 @@ static int dwc3_remove(struct platform_device *pdev)
                break;
        }
 
+       dwc3_free_event_buffers(dwc);
        dwc3_core_exit(dwc);
 
        return 0;