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

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

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]