]> git.droids-corp.org - dpdk.git/commitdiff
net/virtio-user: fix resource leak on probing failure
authorHarold Huang <baymaxhuang@gmail.com>
Thu, 23 Dec 2021 04:42:37 +0000 (12:42 +0800)
committerChenbo Xia <chenbo.xia@intel.com>
Thu, 27 Jan 2022 05:02:57 +0000 (06:02 +0100)
When eth_virtio_dev_init is failed, the registered virtio user memory
event cb is not released and the backend created tap device is not
destroyed.  It would cause some residual tap device existed in the host
and creating a new vdev could be failed because the new virtio_user_dev
could use the same address pointer and register memory event cb to the
same address is not allowed.

Fixes: ca8326a94365 ("net/virtio_user: fix error management during init")
Cc: stable@dpdk.org
Signed-off-by: Harold Huang <baymaxhuang@gmail.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
drivers/net/virtio/virtio_user_ethdev.c

index 0271098f0da0c36f9f3efca00103f240cd3f0f6d..16eca2f94080fd733a088a724f07fd61b0e830d9 100644 (file)
@@ -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;
        }