File bcb9a035-CVE-2013-6458.patch of Package libvirt.openSUSE_13.1_Update

commit bcb9a035a99cf8389069c401c94605aedccdc4df
Author: Jiri Denemark <jdenemar@redhat.com>
Date:   Fri Dec 20 15:04:09 2013 +0100

    qemu: Fix job usage in qemuDomainBlockJobImpl
    
    CVE-2013-6458
    
    Every API that is going to begin a job should do that before fetching
    data from vm->def.
    
    (cherry picked from commit f93d2caa070f6197ab50d372d286018b0ba6bbd8)

Index: libvirt-1.1.2/src/qemu/qemu_driver.c
===================================================================
--- libvirt-1.1.2.orig/src/qemu/qemu_driver.c
+++ libvirt-1.1.2/src/qemu/qemu_driver.c
@@ -14030,16 +14030,25 @@ qemuDomainBlockJobImpl(virDomainObjPtr v
         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) &&
@@ -14047,15 +14056,6 @@ qemuDomainBlockJobImpl(virDomainObjPtr v
         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;
     }
 
openSUSE Build Service is sponsored by