]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_vhost/vhost_user/virtio-net-user.c
vhost: fix crash by removing device when requested
[dpdk.git] / lib / librte_vhost / vhost_user / virtio-net-user.c
index 97c517742f1870d3c5df3fe0f3956560d1a9b6fc..aa087063d6837a752ebac700f27c1e7d44f2733a 100644 (file)
@@ -109,6 +109,10 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct VhostUserMsg *pmsg)
        if (dev == NULL)
                return -1;
 
+       /* Remove from the data plane. */
+       if (dev->flags & VIRTIO_DEV_RUNNING)
+               notify_ops->destroy_device(dev);
+
        if (dev->mem) {
                free_mem_region(dev);
                free(dev->mem);