[libvirt] [PATCH] Prevent crash of libvirtd when attaching to existing qemu process

Jim Fehlig jfehlig at suse.com
Wed Dec 7 18:27:39 UTC 2011


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 |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9309761..45ed011 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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;
-- 
1.7.7




More information about the libvir-list mailing list