Re: [PATCH] Avoid getting '-1:-1' in devices cgroup list

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

 



On 10.12.2014 14:49, Cédric Bosdonnat wrote:
When calling virCgroupAllowAllDevices we get these invalid entries
in the device cgroup config.
     b -1:-1 rw
     c -1:-1 rw
Check for positive values before outputting the major and minor to
avoid that.
---
  src/util/vircgroup.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 166f4dc..3995477 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -2767,11 +2767,11 @@ virCgroupAllowDevice(virCgroupPtr group, char type, int major, int minor,
      char *minorstr = NULL;

      if ((major < 0 && VIR_STRDUP(majorstr, "*") < 0) ||
-            virAsprintf(&majorstr, "%i", major) < 0)
+        (major >= 0 && virAsprintf(&majorstr, "%i", major) < 0))
          goto cleanup;

      if ((minor < 0 && VIR_STRDUP(minorstr, "*") < 0) ||
-            virAsprintf(&minorstr, "%i", minor) < 0)
+        (minor >= 0 && virAsprintf(&minorstr, "%i", minor) < 0))
          goto cleanup;

      if (virAsprintf(&devstr, "%c %s:%s %s", type, majorstr, minorstr,


ACK, nice catch. Safe to push during freeze.

Michal

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