[libvirt] [PATCH] selinux: ignore missing imagelabel in SetSavedStateLabel

Ján Tomko jtomko at redhat.com
Tue Nov 11 08:07:08 UTC 2014


If we have no imagelabel to set (e.g. the domain was created
by qemu-attach where we don't generate an imagelabel) return
success instead of crashing.

https://bugzilla.redhat.com/show_bug.cgi?id=1161831
---
 src/security/security_selinux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index f96be50..db0df7d 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1970,7 +1970,7 @@ virSecuritySELinuxSetSavedStateLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
     virSecurityLabelDefPtr secdef;
 
     secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME);
-    if (!secdef || !secdef->relabel)
+    if (!secdef || !secdef->relabel || !secdef->imagelabel)
         return 0;
 
     return virSecuritySELinuxSetFilecon(savefile, secdef->imagelabel);
-- 
2.0.4




More information about the libvir-list mailing list