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) Conflicts: src/qemu/qemu_driver.c - older style BeginJobWithDriver
This commit is contained in:
parent
324279f2c8
commit
c973eb035e
@ -13022,16 +13022,25 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (qemuDomainObjBeginJobWithDriver(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);
|
device = qemuDiskPathToAlias(vm, path, &idx);
|
||||||
if (!device)
|
if (!device)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
disk = vm->def->disks[idx];
|
disk = vm->def->disks[idx];
|
||||||
|
|
||||||
if (mode == BLOCK_JOB_PULL && disk->mirror) {
|
if (mode == BLOCK_JOB_PULL && disk->mirror) {
|
||||||
virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
|
virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
|
||||||
_("disk '%s' already in active block copy job"),
|
_("disk '%s' already in active block copy job"),
|
||||||
disk->dst);
|
disk->dst);
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
if (mode == BLOCK_JOB_ABORT &&
|
if (mode == BLOCK_JOB_ABORT &&
|
||||||
(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT) &&
|
(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT) &&
|
||||||
@ -13039,15 +13048,6 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
|
|||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
_("pivot of disk '%s' requires an active copy job"),
|
_("pivot of disk '%s' requires an active copy job"),
|
||||||
disk->dst);
|
disk->dst);
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
||||||
_("domain is not running"));
|
|
||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user