Skip to content

Commit

Permalink
net/virtio-user: fix resource leak on probing failure
Browse files Browse the repository at this point in the history
[ upstream commit edca47a ]

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: ca8326a ("net/virtio_user: fix error management during init")

Signed-off-by: Harold Huang <baymaxhuang@gmail.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  • Loading branch information
baymaxhuang authored and kevintraynor committed Feb 21, 2022
1 parent efc7ea9 commit 4210bb8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/virtio/virtio_user_ethdev.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4210bb8

Please sign in to comment.