qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1.0] qiov: prevent double free or use-after-free
Date: Fri, 25 Nov 2011 12:56:20 +0100	[thread overview]
Message-ID: <4ECF8264.7020606@redhat.com> (raw)
In-Reply-To: <1322219182-18502-1-git-send-email-pbonzini@redhat.com>

Am 25.11.2011 12:06, schrieb Paolo Bonzini:
> qemu_iovec_destroy does not clear the QEMUIOVector fully, and the data
> could thus be used after free or freed again.  While I do not know any
> example in the tree, I observed this using virtio-scsi (and SCSI
> scatter/gather) when canceling DMA requests.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

This isn't a bug fix for itself, it just makes bugs in other code more
visible, right? It probably makes sense to do this change, but I'm not
sure about doing it for 1.0.

Kevin

> ---
>  cutils.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/cutils.c b/cutils.c
> index 5d995bc..731a27e 100644
> --- a/cutils.c
> +++ b/cutils.c
> @@ -217,7 +217,10 @@ void qemu_iovec_destroy(QEMUIOVector *qiov)
>  {
>      assert(qiov->nalloc != -1);
>  
> +    qemu_iovec_reset(qiov);
>      g_free(qiov->iov);
> +    qiov->nalloc = 0;
> +    qiov->iov = NULL;
>  }
>  
>  void qemu_iovec_reset(QEMUIOVector *qiov)

  reply	other threads:[~2011-11-25 11:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-25 11:06 [Qemu-devel] [PATCH 1.0] qiov: prevent double free or use-after-free Paolo Bonzini
2011-11-25 11:56 ` Kevin Wolf [this message]
2011-11-25 11:55   ` 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=4ECF8264.7020606@redhat.com \
    --to=kwolf@redhat.com \
    --cc=pbonzini@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).