From: Daniel P. Berrange Date: Fri, 2 Aug 2013 11:12:30 +0000 (+0100) Subject: Fix crashing upgrading from older libvirts with running guests X-Git-Tag: CVE-2013-4239~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1166eeba61d57eb093edf26bee6e45b4bec67ffd;p=thirdparty%2Flibvirt.git Fix crashing upgrading from older libvirts with running guests 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 --- diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 0a28305255..4835bd5003 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 787ddeb4a1..dc949db4dd 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;