Skip to contentSkip to conversation

vhost-user deconnection bug

DISCUSSION Benoît Canet 1 participant 1 message Feb 26, 2015

lore
Share & tools
lore
#0 lore raw

Hi Xie,

I connected a QEMU from git master with the vhost-user from git master and noticed the following bug.

In the following code:

void
user_destroy_device(struct vhost_device_ctx ctx)

{                                                                               
        struct virtio_net *dev = get_device(ctx);                               
                                                                                
        if (dev && (dev->flags & VIRTIO_DEV_RUNNING))                         
                notify_ops->destroy_device(dev);                                
                                                                                
        if (dev && dev->mem) {                                                  
                free_mem_region(dev);                                           
                free(dev->mem);                                                 
                dev->mem = NULL;                                                
        }                                                                       
}

The if (dev && (dev->flags & VIRTIO_DEV_RUNNING)) is evaluated false and notify_ops->destroy_device(dev); is not called when QEMU terminate and provocate the deconnexion.

As a consequence any piece of code busy polling or bursting on the vhost-user device will segfault since it will not be notified of the deconnexion.

By the way VIRTIO_DEV_RUNNING does not seem to be set anywhere.

Best regards

Benoît