Skip to content

Commit

Permalink
cgroup: Check for ret during cgroup1_base_files cft addition
Browse files Browse the repository at this point in the history
There is no check for possible failure while populating
cgroup1_base_files cft in css_populate_dir(), like its cgroup v2 counter
parts cgroup_{base,psi}_files.  In case of failure, the cgroup might not
be set up right.  Add ret value check to return on failure.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Kamalesh Babulal authored and Tejun Heo committed Sep 18, 2023
1 parent ce9ecca commit fd55c0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/cgroup/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1731,8 +1731,10 @@ static int css_populate_dir(struct cgroup_subsys_state *css)
return ret;
}
} else {
cgroup_addrm_files(css, cgrp,
cgroup1_base_files, true);
ret = cgroup_addrm_files(css, cgrp,
cgroup1_base_files, true);
if (ret < 0)
return ret;
}
} else {
list_for_each_entry(cfts, &css->ss->cfts, node) {
Expand Down

0 comments on commit fd55c0a

Please sign in to comment.