[PATCH] Сheck snapshot disk is not NULL when searching it in the VM config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When creating a snapshot of a VM with multiple hard disks,
the snapshot takes into account the presence of all disks
in the system. If, over time, one of the disks is deleted,
the snapshot will continue to store knowledge of the deleted disk.
This results in the fact that at the moment of deleting the snapshot,
at the validation stage, a disk from the snapshot will be searched which
is not in the VM configuration. As a result, vmdisk variable will
be equal to NULL. Dereferencing a null pointer at the time of calling
virStorageSourceIsSameLocation(vmdisk->src, disk->src) will result in SIGSEGV.

Signed-off-by: Fima Shevrin <efim.shevrin@xxxxxxxxxxxxx>
---
 src/qemu/qemu_snapshot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 09ec959f10..bf93cd485e 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -3806,7 +3806,7 @@ qemuSnapshotDeleteValidate(virDomainObj *vm,
             vmdisk = qemuDomainDiskByName(vm->def, snapDisk->name);
             disk = qemuDomainDiskByName(snapdef->parent.dom, snapDisk->name);
 
-            if (!virStorageSourceIsSameLocation(vmdisk->src, disk->src)) {
+            if (vmdisk != NULL && !virStorageSourceIsSameLocation(vmdisk->src, disk->src)) {
                 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                                _("disk image '%1$s' for internal snapshot '%2$s' is not the same as disk image currently used by VM"),
                                snapDisk->name, snap->def->name);
-- 
2.34.1
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux