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.

Conflicts:
        src/qemu/qemu_driver.c

(cherry picked from commit f93d2caa07)
This commit is contained in:
Jiri Denemark 2013-12-20 15:04:09 +01:00 committed by Guido Günther
parent 4dd29d3bdf
commit 3e7d9e54e9

View File

@ -11749,11 +11749,6 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
goto cleanup; goto cleanup;
} }
device = qemuDiskPathToAlias(vm, path, &idx);
if (!device)
goto cleanup;
disk = vm->def->disks[idx];
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0) if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup; goto cleanup;
@ -11763,6 +11758,11 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
goto endjob; goto endjob;
} }
device = qemuDiskPathToAlias(vm, path, &idx);
if (!device)
goto endjob;
disk = vm->def->disks[idx];
qemuDomainObjEnterMonitorWithDriver(driver, vm); qemuDomainObjEnterMonitorWithDriver(driver, vm);
/* XXX - libvirt should really be tracking the backing file chain /* XXX - libvirt should really be tracking the backing file chain
* itself, and validating that base is on the chain, rather than * itself, and validating that base is on the chain, rather than