From patchwork Sat Jun 19 19:06:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 56246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DE8CE1007D1 for ; Sun, 20 Jun 2010 05:16:16 +1000 (EST) Received: from localhost ([127.0.0.1]:35475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQ3WX-00007Z-7P for incoming@patchwork.ozlabs.org; Sat, 19 Jun 2010 15:16:13 -0400 Received: from [140.186.70.92] (port=32798 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQ3Vy-00006N-OL for qemu-devel@nongnu.org; Sat, 19 Jun 2010 15:15:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQ3Vw-0007or-Pv for qemu-devel@nongnu.org; Sat, 19 Jun 2010 15:15:38 -0400 Received: from adelie.canonical.com ([91.189.90.139]:33565) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQ3Vw-0007oc-GS for qemu-devel@nongnu.org; Sat, 19 Jun 2010 15:15:36 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1OQ3Vu-0000Ph-SN for ; Sat, 19 Jun 2010 20:15:35 +0100 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id D38642E8221 for ; Sat, 19 Jun 2010 20:15:33 +0100 (BST) MIME-Version: 1.0 Date: Sat, 19 Jun 2010 19:06:29 -0000 From: Anthony Liguori To: qemu-devel@nongnu.org X-Launchpad-Bug: product=qemu; status=Incomplete; importance=Undecided; assignee=None; X-Launchpad-Bug-Private: no X-Launchpad-Bug-Security-Vulnerability: no X-Launchpad-Bug-Commenters: anthony-codemonkey ncgrandjean References: <20100602160905.25995.39284.malonedeb@palladium.canonical.com> Message-Id: <20100619190632.24319.48869.launchpad@palladium.canonical.com> X-Launchpad-Message-Rationale: Subscriber (QEMU) @qemu-devel-ml Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="None"; Instance="initZopeless config overlay" X-Launchpad-Hash: 54f0a8adc8d507667c425b48117330ebac2fe10c X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [Qemu-devel] [Bug 588803] Re: Image corruption during snapshot creation/deletion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Reply-To: Bug 588803 <588803@bugs.launchpad.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org ** Visibility changed to: Public ** This bug is no longer flagged as a security vulnerability --- qemu-kvm-0.12.2-old/savevm.c 2010-01-18 19:48:25.000000000 +0100 +++ qemu-kvm-0.12.2/savevm.c 2010-02-12 13:45:07.225644169 +0100 @@ -1624,6 +1624,7 @@ int nb_sns, i, ret; ret = -ENOENT; + if (!name) return ret; nb_sns = bdrv_snapshot_list(bs, &sn_tab); if (nb_sns < 0) return ret; @@ -1649,6 +1650,8 @@ QEMUSnapshotInfo sn1, *snapshot = &sn1; int ret; + if (!name) return 0; + QTAILQ_FOREACH(dinfo, &drives, next) { bs = dinfo->bdrv; if (bdrv_can_snapshot(bs) && @@ -1777,6 +1780,11 @@ QTAILQ_FOREACH(dinfo, &drives, next) { bs1 = dinfo->bdrv; if (bdrv_has_snapshot(bs1)) { + if (!name) { + monitor_printf(mon, "Could not find snapshot 'NULL' on " + "device '%s'\n", + bdrv_get_device_name(bs1)); + } ret = bdrv_snapshot_goto(bs1, name); if (ret < 0) { if (bs != bs1) @@ -1804,6 +1812,11 @@ } } + if (!name) { + monitor_printf(mon, "VM state name is NULL\n"); + return -EINVAL; + } + /* Don't even try to load empty VM states */ ret = bdrv_snapshot_find(bs, &sn, name); if ((ret >= 0) && (sn.vm_state_size == 0)) @@ -1840,6 +1853,11 @@ QTAILQ_FOREACH(dinfo, &drives, next) { bs1 = dinfo->bdrv; if (bdrv_has_snapshot(bs1)) { + if (!name) { + monitor_printf(mon, "Could not find snapshot 'NULL' on " + "device '%s'\n", + bdrv_get_device_name(bs1)); + } ret = bdrv_snapshot_delete(bs1, name); if (ret < 0) { if (ret == -ENOTSUP)