[PATCH 1/4] qemu_cgroup: Drop ENOENT special case for RNG devices

Michal Privoznik mprivozn at redhat.com
Tue Mar 15 16:07:16 UTC 2022


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 at redhat.com>
---
 src/qemu/qemu_cgroup.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 34b50ddd1d..9d47803fce 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -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;
     }
 
-- 
2.34.1



More information about the libvir-list mailing list