net/virtio-user: fix resource leak on probing failure

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>
This commit is contained in:
Harold Huang 2021-12-23 12:42:37 +08:00 committed by Chenbo Xia
parent 527ec438eb
commit edca47a1d9

View 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;
}