qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: jasowang@redhat.com, qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] vhost-user: unregister slave req handler at cleanup time
Date: Fri, 30 Jun 2017 12:23:17 -0400 (EDT)	[thread overview]
Message-ID: <1186247051.45558056.1498839797752.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20170630160422.14842-3-maxime.coquelin@redhat.com>



----- Original Message -----
> If the backend sends a request just before closing the socket,
> the aio dispatcher might schedule its reading after the vhost
> device has been cleaned, leading to a NULL pointer dereference
> in slave_read();
> 
> vhost_user_cleanup() already closes the socket but it is not
> enough, the handler has to be unregistered.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  hw/virtio/vhost-user.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 958ee09..2203011 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -779,6 +779,7 @@ static int vhost_user_cleanup(struct vhost_dev *dev)
>  
>      u = dev->opaque;
>      if (u->slave_fd >= 0) {
> +        qemu_set_fd_handler(u->slave_fd, NULL, NULL, NULL);
>          close(u->slave_fd);
>          u->slave_fd = -1;
>      }
> --
> 2.9.4
> 
> 

      reply	other threads:[~2017-06-30 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 16:04 [Qemu-devel] [PATCH 0/2] vhost-user: fix crashes on disconnect when iommu is on Maxime Coquelin
2017-06-30 16:04 ` [Qemu-devel] [PATCH 1/2] vhost: ensure vhost_ops are set before calling iotlb callback Maxime Coquelin
2017-06-30 16:33   ` Marc-André Lureau
2017-06-30 16:04 ` [Qemu-devel] [PATCH 2/2] vhost-user: unregister slave req handler at cleanup time Maxime Coquelin
2017-06-30 16:23   ` Marc-André Lureau [this message]

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=1186247051.45558056.1498839797752.JavaMail.zimbra@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).