From: Christian Brauner Date: Mon, 28 Jun 2021 07:44:20 +0000 (+0200) Subject: cgroups: verify that hierarchies are non-empty X-Git-Tag: lxc-5.0.0~152^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3884%2Fhead;p=thirdparty%2Flxc.git cgroups: verify that hierarchies are non-empty Fixes: #3881 Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgroup.h b/src/lxc/cgroups/cgroup.h index cb2a9751a..d057957b4 100644 --- a/src/lxc/cgroups/cgroup.h +++ b/src/lxc/cgroups/cgroup.h @@ -326,6 +326,9 @@ static inline int prepare_cgroup_ctx(struct cgroup_ops *ops, { __u32 idx; + if (!ops || !ops->hierarchies) + return ret_errno(ENOENT); + for (idx = 0; ops->hierarchies[idx]; idx++) { if (idx >= CGROUP_CTX_MAX_FD) return ret_errno(E2BIG);