From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlzi0-0003nX-2R for qemu-devel@nongnu.org; Wed, 27 Jul 2011 04:43:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qlzhy-0007kv-SL for qemu-devel@nongnu.org; Wed, 27 Jul 2011 04:43:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlzhy-0007kp-Jc for qemu-devel@nongnu.org; Wed, 27 Jul 2011 04:43:14 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6R8hD0k002485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Jul 2011 04:43:13 -0400 Date: Wed, 27 Jul 2011 11:43:44 +0300 From: "Michael S. Tsirkin" Message-ID: <20110727084344.GE15762@redhat.com> References: <3c8905c75dbc9973eb9f0dd0823a0989ee2e12d1.1311755243.git.amit.shah@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3c8905c75dbc9973eb9f0dd0823a0989ee2e12d1.1311755243.git.amit.shah@redhat.com> Subject: Re: [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: Amit Shah Cc: Kevin Wolf , qemu list , Markus Armbruster 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 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