Commit 2a334cfa authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Felipe Balbi

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: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 01da5198
...@@ -1838,6 +1838,8 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1838,6 +1838,8 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err: err:
if (dev) if (dev)
goku_remove (pdev); goku_remove (pdev);
/* gadget_release is not registered yet, kfree explicitly */
kfree(dev);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment