qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Marc-André Lureau" <mlureau@redhat.com>
Cc: qemu-devel@nongnu.org, "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [Qemu-devel] [PULL 32/35] vhost-user: disable chardev handlers on close
Date: Wed, 29 Jun 2016 17:45:15 +0200	[thread overview]
Message-ID: <0a8ed026-c8dd-11a6-07b1-3e7ea41b31c7@redhat.com> (raw)
In-Reply-To: <981859396.766716.1467214284491.JavaMail.zimbra@redhat.com>



On 29/06/2016 17:31, Marc-André Lureau wrote:
> Hi
> 
> ----- Original Message -----
>> This otherwise causes a use-after-free if network backend cleanup
>> is performed before character device cleanup.
>>
>> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> 
> 
> See also my previous (still unreviewed) series:
> https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg01004.html

Oh, interesting!

This is indeed a superset of patch 1, but you need to either delete the
chardev (patch 2) or clear the handlers.  There are only a handful uses
of qemu_chr_delete outside qemu-char.c, which makes me believe that most
of them are wrong...

Paolo

> so: Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> 
>> ---
>>  net/vhost-user.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/net/vhost-user.c b/net/vhost-user.c
>> index 636899a..92f4cfd 100644
>> --- a/net/vhost-user.c
>> +++ b/net/vhost-user.c
>> @@ -151,6 +151,11 @@ static void vhost_user_cleanup(NetClientState *nc)
>>          vhost_net_cleanup(s->vhost_net);
>>          s->vhost_net = NULL;
>>      }
>> +    if (s->chr) {
>> +        qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, NULL);
>> +        qemu_chr_fe_release(s->chr);
>> +        s->chr = NULL;
>> +    }
>>  
>>      qemu_purge_queued_packets(nc);
>>  }
>> --
>> 1.8.3.1
>>

  reply	other threads:[~2016-06-29 15:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 15:23 [Qemu-devel] [PULL v2 00/35] Misc patches for QEMU soft freeze Paolo Bonzini
2016-06-29 15:23 ` [Qemu-devel] [PULL 31/35] vhost-user-test: fix g_cond_wait_until compat implementation Paolo Bonzini
2016-06-29 15:24 ` [Qemu-devel] [PULL 32/35] vhost-user: disable chardev handlers on close Paolo Bonzini
2016-06-29 15:31   ` Marc-André Lureau
2016-06-29 15:45     ` Paolo Bonzini [this message]
2016-06-30  8:59 ` [Qemu-devel] [PULL v2 00/35] Misc patches for QEMU soft freeze Peter Maydell
2016-06-30 13:11   ` Paolo Bonzini

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=0a8ed026-c8dd-11a6-07b1-3e7ea41b31c7@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mlureau@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).