[PATCH] net/virtio: unregister virtio user memery event to fix memory leak problem
Harold Huang
baymaxhuang at gmail.com
Mon Dec 20 13:41:00 CET 2021
When eth_virtio_dev_init is failed, the registered virtio user memery is
not released and creating a new virtio user dev could be failed becase the
new dev could use the same address pointer and the register virtio user
memory to the same address is not allowed.
Signed-off-by: Harold Huang <baymaxhuang at gmail.com>
---
drivers/net/virtio/virtio_user_ethdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 0271098f0d..16eca2f940 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -666,6 +666,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev)
/* previously called by pci probing for physical dev */
if (eth_virtio_dev_init(eth_dev) < 0) {
PMD_INIT_LOG(ERR, "eth_virtio_dev_init fails");
+ virtio_user_dev_uninit(dev);
virtio_user_eth_dev_free(eth_dev);
goto end;
}
--
2.27.0
More information about the dev
mailing list