qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu list <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] virtio-net: Fix potential use-after-free
Date: Wed, 27 Jul 2011 11:43:44 +0300	[thread overview]
Message-ID: <20110727084344.GE15762@redhat.com> (raw)
In-Reply-To: <3c8905c75dbc9973eb9f0dd0823a0989ee2e12d1.1311755243.git.amit.shah@redhat.com>

On Wed, Jul 27, 2011 at 02:00:31PM +0530, Amit Shah wrote:
> virtio_cleanup() will remove the VirtIONet struct that gets allocated
> via virtio_common_init().  Ensure we don't dereference the structure
> after calling the cleanup function.
> 
> Signed-off-by: Amit Shah <amit.shah@redhat.com>

I see. It's not a use after free but will be once
you make virtio_cleanup free the vdev?

> ---
>  hw/virtio-net.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index a32cc01..3f10391 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -1073,6 +1073,6 @@ void virtio_net_exit(VirtIODevice *vdev)
>          qemu_bh_delete(n->tx_bh);
>      }
>  
> -    virtio_cleanup(&n->vdev);
>      qemu_del_vlan_client(&n->nic->nc);
> +    virtio_cleanup(&n->vdev);
>  }
> -- 
> 1.7.6

  reply	other threads:[~2011-07-27  8:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27  8:30 [Qemu-devel] [PATCH 0/4] Fix virtio memleaks Amit Shah
2011-07-27  8:30 ` [Qemu-devel] [PATCH 1/4] virtio-balloon: Add exit handler, fix memleaks Amit Shah
2011-07-27  8:30 ` [Qemu-devel] [PATCH 2/4] virtio-blk: Fix memleak on exit Amit Shah
2011-07-27  9:07   ` Kevin Wolf
2011-07-27  8:30 ` [Qemu-devel] [PATCH 3/4] virtio-net: Fix potential use-after-free Amit Shah
2011-07-27  8:43   ` Michael S. Tsirkin [this message]
2011-07-27  8:51     ` Amit Shah
2011-07-27  8:30 ` [Qemu-devel] [PATCH 4/4] virtio: Plug memleak by freeing vdev Amit Shah
2011-07-27  9:08 ` [Qemu-devel] [PATCH 0/4] Fix virtio memleaks Michael S. Tsirkin
2011-07-27 10:15   ` Amit Shah

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=20110727084344.GE15762@redhat.com \
    --to=mst@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@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).