diff mbox

qemu: Fix crash when defining XML with bogus emulator

Message ID 7c9d7a6aad364546da8b23c516fb2cbb9ec328f4.1452282495.git.crobinso@redhat.com
State Accepted
Commit 3d92a000ff51225b3afb4dbb83e58e4446f9b035
Headers show

Commit Message

Cole Robinson Jan. 8, 2016, 7:48 p.m. UTC
We weren't checking for failure of qemuCaps lookup
---
 src/qemu/qemu_domain.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.5.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Cole Robinson Jan. 9, 2016, 1:29 a.m. UTC | #1
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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

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;