On 08/12/2014 03:44 PM, Peter Krempa wrote:
Check that secdef->imagelabel exists before blindly applying it.
---
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 c078cab..cf59d6c 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1962,7 +1962,7 @@ virSecuritySELinuxSetSavedStateLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
virSecurityLabelDefPtr secdef;
secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME);
- if (!secdef || !secdef->relabel)
+ if (!secdef || !secdef->imagelabel || !secdef->relabel)
return 0;
return virSecuritySELinuxSetFilecon(savefile, secdef->imagelabel);
I think this is just covers up incorrect usage of this function on shutoff
domains, because if a running domain has a selinux label, it should have the
imagelabel generated.
Jan