From patchwork Tue Jun 21 17:34:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 101346 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 0CD1AB6F83 for ; Wed, 22 Jun 2011 04:26:56 +1000 (EST) Received: from localhost ([::1]:36169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ5f2-0003Qr-6x for incoming@patchwork.ozlabs.org; Tue, 21 Jun 2011 14:26:52 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ4pw-0006Kz-Tn for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:34:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZ4pv-0005WJ-HE for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:34:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ4pu-0005WC-Vq for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:34:03 -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 p5LHY2I9004270 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 Jun 2011 13:34:02 -0400 Received: from redhat.com (dhcp-1-35.tlv.redhat.com [10.35.1.35]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p5LHY0Zr018250; Tue, 21 Jun 2011 13:34:00 -0400 Date: Tue, 21 Jun 2011 20:34:17 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org, Jason Wang , armbru@redhat.com, chrisw@redhat.com Message-ID: <20110621173417.GA17272@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Subject: [Qemu-devel] [PATCHv2] vhost: fix double free on device stop 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 vhost dev stop failed to clear the log field. Typically not an issue as dev start overwrites this field, but if logging gets disabled before the following start, it doesn't so this causes a double free. Signed-off-by: Michael S. Tsirkin Acked-by: Chris Wright Acked-by: Jason Wang --- hw/vhost.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/vhost.c b/hw/vhost.c index 80f771e..c3d8821 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -784,5 +784,6 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->started = false; qemu_free(hdev->log); + hdev->log = NULL; hdev->log_size = 0; }