From: Jim Fehlig Date: Wed, 7 Dec 2011 18:23:03 +0000 (-0700) Subject: Prevent crash of libvirtd when attaching to existing qemu process X-Git-Tag: v0.9.8~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=284230199af915a90322d6cc4a6210aaa2a33b28;p=thirdparty%2Flibvirt.git Prevent crash of libvirtd when attaching to existing qemu process 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. --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 93097613ec..45ed011fec 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;