From: Cole Robinson Date: Mon, 22 Mar 2010 14:45:36 +0000 (-0400) Subject: security: selinux: Fix crash when releasing non-existent label X-Git-Tag: v0.8.0~253 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65e97240e6e4606820dd1c42ac172319e0af4d8d;p=thirdparty%2Flibvirt.git security: selinux: Fix crash when releasing non-existent label This can be triggered by the qemuStartVMDaemon cleanup path if a VM references a non-existent USB device (by product) in the XML. --- diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 975b31524b..6680e2d238 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -632,7 +632,8 @@ SELinuxReleaseSecurityLabel(virDomainObjPtr vm) { const virSecurityLabelDefPtr secdef = &vm->def->seclabel; - if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC) + if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC || + secdef->label == NULL) return 0; context_t con = context_new(secdef->label);