]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_namespace: Tolerate missing ACLs when creating a path in namespace
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 6 Sep 2022 11:37:23 +0000 (13:37 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 23 Sep 2022 13:47:54 +0000 (15:47 +0200)
When creating a path in a domain's mount namespace we try to set
ACLs on it, so that it's a verbatim copy of the path in parent's
namespace. The ACLs are queried upfront (by
qemuNamespaceMknodItemInit()) but this is fault tolerant so the
pointer to ACLs might be NULL (meaning no ACLs were queried, for
instance because the underlying filesystem does not support
them). But then we take this NULL and pass it to virFileSetACLs()
which immediately returns an error because NULL is invalid value.

Mimic what we do with SELinux label - only set ACLs if they are
non-NULL which includes symlinks.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_namespace.c

index 98cd794666b936c4ff4a74086069b1ccaae5d0c1..71e3366ca5e849e50daad8f4175b8827776e0620 100644 (file)
@@ -1040,8 +1040,7 @@ qemuNamespaceMknodOne(qemuNamespaceMknodItem *data)
         goto cleanup;
     }
 
-    /* Symlinks don't have ACLs. */
-    if (!isLink &&
+    if (data->acl &&
         virFileSetACLs(data->file, data->acl) < 0 &&
         errno != ENOTSUP) {
         virReportSystemError(errno,