Merge pull request #3884 from brauner/2021-06-28.fixes

cgroups: verify that hierarchies are non-empty
This commit is contained in:
Wolfgang Bumiller 2021-06-28 12:32:11 +02:00 committed by GitHub
commit 5e3ec98927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -326,6 +326,9 @@ static inline int prepare_cgroup_ctx(struct cgroup_ops *ops,
{ {
__u32 idx; __u32 idx;
if (!ops || !ops->hierarchies)
return ret_errno(ENOENT);
for (idx = 0; ops->hierarchies[idx]; idx++) { for (idx = 0; ops->hierarchies[idx]; idx++) {
if (idx >= CGROUP_CTX_MAX_FD) if (idx >= CGROUP_CTX_MAX_FD)
return ret_errno(E2BIG); return ret_errno(E2BIG);