[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/3] security: selinux: Set saved state label only if it is available



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);
-- 
2.0.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]