From: Alexey Khoroshilov Date: Fri, 26 Aug 2016 00:06:02 +0000 (+0300) Subject: usb: gadget: goku_udc: fix memory leak in goku_probe() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2a334cfaf393187d592999d1039135e000a68e9a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git usb: gadget: goku_udc: fix memory leak in goku_probe() Memory allocated for goku_udc device is not deallocated at error paths in goku_probe(), because gadget_release() destructor is not registered yet. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c index 1400415fe67a..5107987bd353 100644 --- a/drivers/usb/gadget/udc/goku_udc.c +++ b/drivers/usb/gadget/udc/goku_udc.c @@ -1838,6 +1838,8 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) err: if (dev) goku_remove (pdev); + /* gadget_release is not registered yet, kfree explicitly */ + kfree(dev); return retval; }