]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: don't accidently alter lxc.cgroup.dir 3603/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 15 Dec 2020 10:56:50 +0000 (11:56 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 15 Dec 2020 10:58:35 +0000 (11:58 +0100)
Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index b52bd11b44d8beccc9f26056aed3e674c47e1b2f..bcf50ad3c409fbf9f69b429f2bbd2e8a6acb37e4 100644 (file)
@@ -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);