From patchwork Wed Jul 27 08:30:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 106994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C1CE6B6F00 for ; Wed, 27 Jul 2011 18:31:50 +1000 (EST) Received: from localhost ([::1]:57418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlzWs-0007eT-DW for incoming@patchwork.ozlabs.org; Wed, 27 Jul 2011 04:31:46 -0400 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 Received: from localhost (ovpn-113-54.phx2.redhat.com [10.3.113.54]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6R8V9VS003168; Wed, 27 Jul 2011 04:31:11 -0400 From: Amit Shah To: qemu list 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: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Amit Shah , Markus Armbruster , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH 3/4] virtio-net: Fix potential use-after-free X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); }