[libvirt] [PATCH 2/4] qemu: Add check for NULL cgroup return from virCgroupNewMachine

John Ferlan jferlan at redhat.com
Fri Jan 8 16:48:21 UTC 2016


Commit id '71ce4759' altered the cgroup processing with respect to the
call to virCgroupAddTask being moved out from lower layers into the calling
layers especially for qemu processing of emulator and vcpu threads.

What was missed in the processing was that it is possible for a code path to
return a NULL cgroup *and* a 0 return status via virCgroupNewPartition
failure when virCgroupNewIgnoreError succeeded when virCgroupNewMachineManual
returns. This was initially seen for lxc cgroup processing and patched
by comit id 'ae09988eb'. We'll make the same check here as a subsquent
patch will revert commit id 'a41c00b47' which would leave the possibility
that priv->cgroup is NULL.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 91b3328..515d76a 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -782,7 +782,7 @@ qemuInitCgroup(virQEMUDriverPtr driver,
                             nnicindexes, nicindexes,
                             vm->def->resource->partition,
                             cfg->cgroupControllers,
-                            &priv->cgroup) < 0) {
+                            &priv->cgroup) < 0 || !priv->cgroup) {
         if (virCgroupNewIgnoreError())
             goto done;
 
-- 
2.5.0




More information about the libvir-list mailing list