[pve-devel] [PATCH stable-4 guest-common] Fix #1480: die if snapshot name is not found before set_lock is used

Alwin Antreich a.antreich at proxmox.com
Mon Aug 28 11:23:39 CEST 2017


Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 PVE/AbstractConfig.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm
index 482f0e2..9495798 100644
--- a/PVE/AbstractConfig.pm
+++ b/PVE/AbstractConfig.pm
@@ -467,9 +467,13 @@ sub snapshot_delete {

     my $prepare = 1;

-    my $snap;
     my $unused = [];

+    my $conf = $class->load_config($vmid);
+    my $snap = $conf->{snapshots}->{$snapname};
+
+    die "snapshot '$snapname' does not exist\n" if !defined($snap);
+
     $class->set_lock($vmid, 'snapshot-delete')
 	if (!$drivehash); # doesn't already have a 'snapshot' lock

--
2.11.0





More information about the pve-devel mailing list