Skip to content

Commit

Permalink
usb: gadget: goku_udc: fix memory leak in goku_probe()
Browse files Browse the repository at this point in the history
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 <khoroshilov@ispras.ru>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Alexey Khoroshilov authored and Felipe Balbi committed Aug 29, 2016
1 parent 01da519 commit 2a334cf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/gadget/udc/goku_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 2a334cf

Please sign in to comment.