aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Novikov2020-07-21 23:15:58 +0300
committerFelipe Balbi2020-07-24 16:45:13 +0300
commit2468c877da428ebfd701142c4cdfefcfb7d4c00e (patch)
tree4b77217def6700e872e0002bd34befbd055fa814
parentb2aeb6da3d6ee562e57ad3a7d73a7de0c36ce8eb (diff)
usb: gadget: net2280: fix memory leak on probe error handling paths
Driver does not release memory for device on error handling paths in net2280_probe() when gadget_release() is not registered yet. The patch fixes the bug like in other similar drivers. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Signed-off-by: Felipe Balbi <balbi@kernel.org>
-rw-r--r--drivers/usb/gadget/udc/net2280.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 5eff85eeaa5a..7530bd9a08c4 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -3781,8 +3781,10 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return 0;
done:
- if (dev)
+ if (dev) {
net2280_remove(pdev);
+ kfree(dev);
+ }
return retval;
}