]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Prevent crash of libvirtd when attaching to existing qemu process
authorJim Fehlig <jfehlig@suse.com>
Wed, 7 Dec 2011 18:23:03 +0000 (11:23 -0700)
committerJim Fehlig <jfehlig@suse.com>
Wed, 7 Dec 2011 18:23:03 +0000 (11:23 -0700)
With security_driver set to "none" in /etc/libvirt/qemu.conf,
libvirtd would crash when attempted to attach to an existing
qemu process.  Only copy the security model if it actually exists.

src/qemu/qemu_process.c

index 93097613ece089ca6ba2efc817054bd1b623b7d2..45ed011fec6b2c1a6645ad60f885a979c32c6a87 100644 (file)
@@ -3609,7 +3609,8 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
     if (virSecurityManagerGetProcessLabel(driver->securityManager,
                                           vm, seclabel) < 0)
         goto cleanup;
-    if (!(vm->def->seclabel.model = strdup(driver->caps->host.secModel.model)))
+    if (driver->caps->host.secModel.model &&
+        !(vm->def->seclabel.model = strdup(driver->caps->host.secModel.model)))
         goto no_memory;
     if (!(vm->def->seclabel.label = strdup(seclabel->label)))
         goto no_memory;