提交 b48fb801 编写于 作者: J Jim Meyering

qemudDomainSetVcpus: avoid NULL-deref

* src/qemu/qemu_driver.c (qemudDomainSetVcpus): Avoid NULL-deref
upon unknown UUID.  Call qemuDomainObjBeginJob(vm) only after
ensuring that vm != NULL, not before.  This potential NULL-deref
was introduced by commit 2c555d87.
上级 39b3845f
...@@ -5498,9 +5498,6 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { ...@@ -5498,9 +5498,6 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
qemuDriverUnlock(driver); qemuDriverUnlock(driver);
if (qemuDomainObjBeginJob(vm) < 0)
goto cleanup;
if (!vm) { if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
...@@ -5509,6 +5506,9 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { ...@@ -5509,6 +5506,9 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
goto endjob; goto endjob;
} }
if (qemuDomainObjBeginJob(vm) < 0)
goto cleanup;
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_OPERATION_INVALID, qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running")); "%s", _("domain is not running"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册