]> xenbits.xensource.com Git - libvirt.git/commitdiff
security: selinux: Fix crash when releasing non-existent label
authorCole Robinson <crobinso@redhat.com>
Mon, 22 Mar 2010 14:45:36 +0000 (10:45 -0400)
committerCole Robinson <crobinso@redhat.com>
Mon, 22 Mar 2010 14:45:36 +0000 (10:45 -0400)
This can be triggered by the qemuStartVMDaemon cleanup path if a
VM references a non-existent USB device (by product) in the XML.

src/security/security_selinux.c

index 975b31524b0aa0256af0b4cd606e297d1732a84a..6680e2d23841b55464c7165d4c3c75c0ec20219c 100644 (file)
@@ -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);