]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_cgroup: Drop ENOENT special case for RNG devices
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 15 Mar 2022 11:37:44 +0000 (12:37 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 16 Mar 2022 12:22:17 +0000 (13:22 +0100)
When allowing or denying RNG device in CGroups there's a special
check if the backend device exists (errno == ENOENT) in which
case success is returned to caller. This is in contrast with the
rest of the functions and in fact wrong too - if the backend
device doesn't exist then QEMU will fail opening it. Might as
well signal error here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_cgroup.c

index 34b50ddd1d07544aacbb816e350565d4774a33d7..9d47803fcee035882fd95107b78b646e7f2bf6c3 100644 (file)
@@ -630,8 +630,7 @@ qemuSetupRNGCgroup(virDomainObj *vm,
         virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
                                  rng->source.file,
                                  "rw", rv);
-        if (rv < 0 &&
-            !virLastErrorIsSystemErrno(ENOENT))
+        if (rv < 0)
             return -1;
     }
 
@@ -657,8 +656,7 @@ qemuTeardownRNGCgroup(virDomainObj *vm,
         virDomainAuditCgroupPath(vm, priv->cgroup, "deny",
                                  rng->source.file,
                                  "rw", rv);
-        if (rv < 0 &&
-            !virLastErrorIsSystemErrno(ENOENT))
+        if (rv < 0)
             return -1;
     }