]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups/cgfsng: cgfsng_devices_activate()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 7 Dec 2019 23:43:40 +0000 (00:43 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 7 Dec 2019 23:43:40 +0000 (00:43 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index f6e7a9df6cbf5a0c3e2dab59dc9b518509421dd2..fd5ab0cf13150336bd1c82c5638c77c2606eb1ba 100644 (file)
@@ -2810,12 +2810,26 @@ __cgfsng_ops bool cgfsng_devices_activate(struct cgroup_ops *ops,
 {
 #ifdef HAVE_STRUCT_BPF_CGROUP_DEV_CTX
        __do_bpf_program_free struct bpf_program *devices = NULL;
-       struct lxc_conf *conf = handler->conf;
-       struct hierarchy *unified = ops->unified;
        int ret;
+       struct lxc_conf *conf;
+       struct hierarchy *unified;
        struct lxc_list *it;
        struct bpf_program *devices_old;
 
+       if (!ops)
+               return ret_set_errno(false, ENOENT);
+
+       if (!ops->hierarchies)
+               return true;
+
+       if (!ops->container_cgroup)
+               return ret_set_errno(false, EEXIST);
+
+       if (!handler || !handler->conf)
+               return ret_set_errno(false, EINVAL);
+       conf = handler->conf;
+
+       unified = ops->unified;
        if (!unified || !unified->bpf_device_controller ||
            !unified->container_full_path || lxc_list_empty(&conf->devices))
                return true;