All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit.canet-J9ArbTHlV+bR7s880joybQ@public.gmane.org>
To: huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: vhost-user deconnection bug
Date: Thu, 26 Feb 2015 16:28:41 +0100	[thread overview]
Message-ID: <20150226152841.GA12516@irqsave.net> (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                      

                 reply	other threads:[~2015-02-26 15:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150226152841.GA12516@irqsave.net \
    --to=benoit.canet-j9arbthlv+br7s880joybq@public.gmane.org \
    --cc=huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.