[libvirt] [PATCH] qemu: Fix crash when defining XML with bogus emulator

We weren't checking for failure of qemuCaps lookup --- src/qemu/qemu_domain.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 00c780d..97534c0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1247,7 +1247,9 @@ qemuDomainDefPostParse(virDomainDefPtr def, !(def->emulator = virDomainDefGetDefaultEmulator(def, caps))) return ret; - qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator); + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, + def->emulator))) + goto cleanup; if (qemuDomainDefAddDefaultDevices(def, qemuCaps) < 0) goto cleanup; -- 2.5.0

On 01/08/2016 02:48 PM, Cole Robinson wrote:
We weren't checking for failure of qemuCaps lookup --- src/qemu/qemu_domain.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 00c780d..97534c0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1247,7 +1247,9 @@ qemuDomainDefPostParse(virDomainDefPtr def, !(def->emulator = virDomainDefGetDefaultEmulator(def, caps))) return ret;
- qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator); + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, + def->emulator))) + goto cleanup;
if (qemuDomainDefAddDefaultDevices(def, qemuCaps) < 0) goto cleanup;
ACK.

On 01/08/2016 08:03 PM, Laine Stump wrote:
On 01/08/2016 02:48 PM, Cole Robinson wrote:
We weren't checking for failure of qemuCaps lookup --- src/qemu/qemu_domain.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 00c780d..97534c0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1247,7 +1247,9 @@ qemuDomainDefPostParse(virDomainDefPtr def, !(def->emulator = virDomainDefGetDefaultEmulator(def, caps))) return ret; - qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator); + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, + def->emulator))) + goto cleanup; if (qemuDomainDefAddDefaultDevices(def, qemuCaps) < 0) goto cleanup;
ACK.
Thanks, pushed now - Cole
participants (2)
-
Cole Robinson
-
Laine Stump