This is a counterpart for f1f68ca33. While we set the security
labels on various directories that domain is going to use (e.g.
channel target directory) we don't restore the permissions back.
Leaving a hanging entry in virtlockd.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 src/qemu/qemu_process.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8aa9efc..e2968ea 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5243,15 +5243,21 @@ void qemuProcessStop(virQEMUDriverPtr driver,
         priv->monConfig = NULL;
     }
 
-    ignore_value(virAsprintf(&tmppath, "%s/domain-%s",
-                             cfg->libDir, vm->def->name));
-    virFileDeleteTree(tmppath);
-    VIR_FREE(tmppath);
+    if (virAsprintf(&tmppath, "%s/domain-%s",
+                    cfg->libDir, vm->def->name) > 0) {
+        virSecurityManagerDomainRestoreDirLabel(driver->securityManager,
+                                                vm->def, tmppath);
+        virFileDeleteTree(tmppath);
+        VIR_FREE(tmppath);
+    }
 
-    ignore_value(virAsprintf(&tmppath, "%s/domain-%s",
-                             cfg->channelTargetDir, vm->def->name));
-    virFileDeleteTree(tmppath);
-    VIR_FREE(tmppath);
+    if (virAsprintf(&tmppath, "%s/domain-%s",
+                    cfg->channelTargetDir, vm->def->name) > 0) {
+        virSecurityManagerDomainRestoreDirLabel(driver->securityManager,
+                                                vm->def, tmppath);
+        virFileDeleteTree(tmppath);
+        VIR_FREE(tmppath);
+    }
 
     ignore_value(virDomainChrDefForeach(vm->def,
                                         false,
-- 
2.4.9

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

Reply via email to