summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorEvgeny Novikov <novikov@ispras.ru>2020-07-21 23:15:58 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-21 10:48:06 +0300
commit7f15121bd7ef35c57558d317123aabffc501d434 (patch)
treeec6e99c8b128f9b47b4bd3a9f31302a1889e0902 /drivers/usb/gadget
parent47298eebd502c9b6651a23d72c80384b4de9e99f (diff)
downloadlinux-7f15121bd7ef35c57558d317123aabffc501d434.tar.xz
usb: gadget: net2280: fix memory leak on probe error handling paths
[ Upstream commit 2468c877da428ebfd701142c4cdfefcfb7d4c00e ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/usb/gadget')
-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 170327f84ea1..f1ac9a49e2bf 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -3786,8 +3786,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;
}