]> 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>
Sat, 7 Dec 2019 23:13:37 +0000 (00:13 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index d1a18174cfe649aabbf027f4990cf3a31554e822..1638f5d528287dbda804a99190047f10fc926146 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++) {