From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlzWN-0006e6-Ct for qemu-devel@nongnu.org; Wed, 27 Jul 2011 04:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlzWM-0005Wj-EY for qemu-devel@nongnu.org; Wed, 27 Jul 2011 04:31:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlzWM-0005Wd-0I for qemu-devel@nongnu.org; Wed, 27 Jul 2011 04:31:14 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6R8VDmp001723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Jul 2011 04:31:13 -0400 From: Amit Shah Date: Wed, 27 Jul 2011 14:00:31 +0530 Message-Id: <3c8905c75dbc9973eb9f0dd0823a0989ee2e12d1.1311755243.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 3/4] virtio-net: Fix potential use-after-free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Kevin Wolf , Amit Shah , Markus Armbruster , "Michael S. Tsirkin" 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 --- 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