]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups/cgfsng: rework cgfsng_payload_enter()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 7 Dec 2019 23:13:14 +0000 (00:13 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 8 Dec 2019 01:35:59 +0000 (02:35 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 6d10855d5af76ddf05b115407f5c222bc2e6e7a5..8a40f4f007505d000fc5682d9bd15c3f47f1e4e9 100644 (file)
@@ -1491,9 +1491,18 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops,
        int len;
        char pidstr[INTTYPE_TO_STRLEN(pid_t)];
 
+       if (!ops)
+               return ret_set_errno(false, ENOENT);
+
        if (!ops->hierarchies)
                return true;
 
+       if (!ops->container_cgroup)
+               return ret_set_errno(false, ENOENT);
+
+       if (!handler || !handler->conf)
+               return ret_set_errno(false, EINVAL);
+
        len = snprintf(pidstr, sizeof(pidstr), "%d", handler->pid);
 
        for (int i = 0; ops->hierarchies[i]; i++) {