[PATCH] Fix crashing upgrading from older libvirts with running guests

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

If upgrading from a libvirt that is older than 1.0.5, we can
not assume that vm->def->resource is non-NULL. This bogus
assumption caused libvirtd to crash

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/lxc/lxc_process.c  | 8 ++++++--
 src/qemu/qemu_cgroup.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 0a28305..4835bd5 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1204,7 +1204,9 @@ int virLXCProcessStart(virConnectPtr conn,
     }
 
     if (virCgroupNewDetectMachine(vm->def->name, "lxc", vm->pid,
-                                  vm->def->resource->partition,
+                                  vm->def->resource ?
+                                  vm->def->resource->partition :
+                                  NULL,
                                   -1, &priv->cgroup) < 0)
         goto error;
 
@@ -1413,7 +1415,9 @@ virLXCProcessReconnectDomain(virDomainObjPtr vm,
             goto error;
 
         if (virCgroupNewDetectMachine(vm->def->name, "lxc", vm->pid,
-                                      vm->def->resource->partition,
+                                      vm->def->resource ?
+                                      vm->def->resource->partition :
+                                      NULL,
                                       -1, &priv->cgroup) < 0)
             goto error;
 
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 787ddeb..dc949db 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -707,7 +707,9 @@ qemuConnectCgroup(virQEMUDriverPtr driver,
     if (virCgroupNewDetectMachine(vm->def->name,
                                   "qemu",
                                   vm->pid,
-                                  vm->def->resource->partition,
+                                  vm->def->resource ?
+                                  vm->def->resource->partition :
+                                  NULL,
                                   cfg->cgroupControllers,
                                   &priv->cgroup) < 0)
         goto cleanup;
-- 
1.8.1.4

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