[libvirt] [PATCH] qemu: Fix the crash in qemuDomainBlockCopyCommon

Shanzhi Yu shyu at redhat.com
Mon Apr 27 07:38:57 UTC 2015


The crash caused when checking the backing file path of a disk while
the disk has no backing file, add a check before using disk->src->backingStore->path

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1215569
---
 src/qemu/qemu_driver.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 70bf7aa..175d00b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16816,6 +16816,15 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
         goto endjob;
 
     if ((flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW) &&
+        !disk->src->backingStore) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("disk '%s' has no backing file, so shallow copy "
+                         "is not possible"),
+                       disk->src->path);
+        goto endjob;
+    }
+
+    if ((flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW) &&
         mirror->format == VIR_STORAGE_FILE_RAW &&
         disk->src->backingStore->path) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-- 
2.1.0




More information about the libvir-list mailing list