提交 2468c877 编写于 作者: E Evgeny Novikov 提交者: Felipe Balbi

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: NEvgeny Novikov <novikov@ispras.ru>
Signed-off-by: NFelipe Balbi <balbi@kernel.org>
上级 b2aeb6da
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册