From c583072d67e3079f9dc4b4b78c141190cd30a6cc Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 15 Dec 2020 11:56:50 +0100 Subject: [PATCH] confile: don't accidently alter lxc.cgroup.dir Cc: stable-4.0 Signed-off-by: Christian Brauner --- src/lxc/confile.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lxc/confile.c b/src/lxc/confile.c index b52bd11b4..bcf50ad3c 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -1759,6 +1759,9 @@ static int set_config_cgroup2_controller(const char *key, const char *value, static int set_config_cgroup_dir(const char *key, const char *value, struct lxc_conf *lxc_conf, void *data) { + if (strcmp(key, "lxc.cgroup.dir") != 0) + return ret_errno(EINVAL); + if (lxc_config_value_empty(value)) return clr_config_cgroup_dir(key, lxc_conf, NULL); @@ -3688,6 +3691,9 @@ static int get_config_cgroup_dir(const char *key, char *retv, int inlen, int len; int fulllen = 0; + if (strcmp(key, "lxc.cgroup.dir") != 0) + return ret_errno(EINVAL); + if (!retv) inlen = 0; else @@ -4607,6 +4613,9 @@ static inline int clr_config_cgroup2_controller(const char *key, static int clr_config_cgroup_dir(const char *key, struct lxc_conf *lxc_conf, void *data) { + if (strcmp(key, "lxc.cgroup.dir") != 0) + return ret_errno(EINVAL); + if (lxc_conf->cgroup_meta.dir) free_disarm(lxc_conf->cgroup_meta.dir); -- 2.47.2