[PATCH] selinux: Only close the selabel_handle once

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

 



On selinux driver initialization failure (missing/incorrectly
formated contexts file), selabel_handle was closed twice.

Introduced by 6159710.
---
 src/security/security_selinux.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 38de060..c408fa8 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -460,6 +460,7 @@ virSecuritySELinuxLXCInitialize(virSecurityManagerPtr mgr)
 error:
 # if HAVE_SELINUX_LABEL_H
     selabel_close(data->label_handle);
+    data->label_handle = NULL;
 # endif
     virConfFree(selinux_conf);
     VIR_FREE(data->domain_context);
@@ -547,6 +548,7 @@ virSecuritySELinuxQEMUInitialize(virSecurityManagerPtr mgr)
 error:
 #if HAVE_SELINUX_LABEL_H
     selabel_close(data->label_handle);
+    data->label_handle = NULL;
 #endif
     VIR_FREE(data->domain_context);
     VIR_FREE(data->alt_domain_context);
@@ -808,7 +810,8 @@ virSecuritySELinuxSecurityDriverClose(virSecurityManagerPtr mgr)
         return 0;
 
 #if HAVE_SELINUX_LABEL_H
-    selabel_close(data->label_handle);
+    if (data->label_handle)
+        selabel_close(data->label_handle);
 #endif
 
     virHashFree(data->mcs);
-- 
1.8.1.5

--
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]