]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: blockcopy: Initialize correct source structure
authorPeter Krempa <pkrempa@redhat.com>
Tue, 15 Jul 2014 08:31:36 +0000 (10:31 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 15 Jul 2014 08:31:36 +0000 (10:31 +0200)
4cc1f1a01fb338de939ba88eb933931687b22336 introduced a crash when doing a
block copy as virStorageSourceInitChainElement was called on
"disk->mirror" that is still NULL at that point instead of "mirror"
which temporarily holds the mirror source struct until it's fully
initialized. This resulted into a crash as a NULL was dereferenced.

Reported by: Shanzi Yu <shyu@redhat.com>

src/qemu/qemu_driver.c

index 8d40bc9d0ee02194bd0ed4e775ee8fe75be27b90..c0ad446aadab794efb392027ef581b32513454c6 100644 (file)
@@ -15309,7 +15309,7 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
     if (VIR_STRDUP(mirror->path, dest) < 0)
         goto endjob;
 
-    if (virStorageSourceInitChainElement(disk->mirror, disk->src, false) < 0)
+    if (virStorageSourceInitChainElement(mirror, disk->src, false) < 0)
         goto endjob;
 
     if (qemuDomainPrepareDiskChainElement(driver, vm, mirror,