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

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>
---
 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

  parent reply	other threads:[~2011-07-27  8:31 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 ` Amit Shah [this message]
2011-07-27  8:43   ` [Qemu-devel] [PATCH 3/4] virtio-net: Fix potential use-after-free Michael S. Tsirkin
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=3c8905c75dbc9973eb9f0dd0823a0989ee2e12d1.1311755243.git.amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@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).