[lxc-devel] [lxc/master] cgfsng: check whether we have a conf

brauner on Github lxc-bot at linuxcontainers.org
Wed Sep 27 16:26:09 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 494 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170927/c8cde9c9/attachment.bin>
-------------- next part --------------
From 9b5396f9d55aa5a251bfeaba1cd4e97e3183f387 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 27 Sep 2017 18:24:42 +0200
Subject: [PATCH] cgfsng: check whether we have a conf

We can't rely in general on the presence of an initialized conf on cgroup init
time. One good example are our criu codepaths.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/cgroups/cgfsng.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index ed391a616..897336f07 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -1175,8 +1175,10 @@ static void *cgfsng_init(struct lxc_handler *handler)
 	d->name = must_copy_string(handler->name);
 
 	/* copy per-container cgroup information */
-	d->cgroup_meta.dir = must_copy_string(handler->conf->cgroup_meta.dir);
-	d->cgroup_meta.controllers = must_copy_string(handler->conf->cgroup_meta.controllers);
+	if (handler->conf) {
+		d->cgroup_meta.dir = must_copy_string(handler->conf->cgroup_meta.dir);
+		d->cgroup_meta.controllers = must_copy_string(handler->conf->cgroup_meta.controllers);
+	}
 
 	/* copy system-wide cgroup information */
 	cgroup_pattern = lxc_global_config_value("lxc.cgroup.pattern");


More information about the lxc-devel mailing list