]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix job usage in qemuDomainBlockJobImpl
authorJiri Denemark <jdenemar@redhat.com>
Fri, 20 Dec 2013 14:04:09 +0000 (15:04 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 7 Jan 2014 15:10:42 +0000 (16:10 +0100)
CVE-2013-6458

Every API that is going to begin a job should do that before fetching
data from vm->def.

src/qemu/qemu_driver.c

index 1e9cd282cbd3dec4618852a4f10d1257d2054263..0ed5b6bc919571bb234d17c56f007385239ef605 100644 (file)
@@ -14249,16 +14249,25 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
         goto cleanup;
     }
 
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+        goto cleanup;
+
+    if (!virDomainObjIsActive(vm)) {
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("domain is not running"));
+        goto endjob;
+    }
+
     device = qemuDiskPathToAlias(vm, path, &idx);
     if (!device)
-        goto cleanup;
+        goto endjob;
     disk = vm->def->disks[idx];
 
     if (mode == BLOCK_JOB_PULL && disk->mirror) {
         virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
                        _("disk '%s' already in active block copy job"),
                        disk->dst);
-        goto cleanup;
+        goto endjob;
     }
     if (mode == BLOCK_JOB_ABORT &&
         (flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT) &&
@@ -14266,15 +14275,6 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
         virReportError(VIR_ERR_OPERATION_INVALID,
                        _("pivot of disk '%s' requires an active copy job"),
                        disk->dst);
-        goto cleanup;
-    }
-
-    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
-        goto cleanup;
-
-    if (!virDomainObjIsActive(vm)) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("domain is not running"));
         goto endjob;
     }