diff options
author | Tejun Heo <tj@kernel.org> | 2016-09-23 23:55:49 +0300 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-09-23 23:55:49 +0300 |
commit | 9157056da8f8c4a6305f15619e269f164b63a6de (patch) | |
tree | 3b2cea5209fae8b62b46ab19c3ce4d4a897b9b40 /drivers/regulator/internal.h | |
parent | 8a15b81741879fa89601b03c0e50b0d780d65bc0 (diff) | |
download | linux-9157056da8f8c4a6305f15619e269f164b63a6de.tar.xz |
cgroup: fix invalid controller enable rejections with cgroup namespace
On the v2 hierarchy, "cgroup.subtree_control" rejects controller
enables if the cgroup has processes in it. The enforcement of this
logic assumes that the cgroup wouldn't have any css_sets associated
with it if there are no tasks in the cgroup, which is no longer true
since a79a908fd2b0 ("cgroup: introduce cgroup namespaces").
When a cgroup namespace is created, it pins the css_set of the
creating task to use it as the root css_set of the namespace. This
extra reference stays as long as the namespace is around and makes
"cgroup.subtree_control" think that the namespace root cgroup is not
empty even when it is and thus reject controller enables.
Fix it by making cgroup_subtree_control() walk and test emptiness of
each css_set instead of testing whether the list_head is empty.
While at it, update the comment of cgroup_task_count() to indicate
that the returned value may be higher than the number of tasks, which
has always been true due to temporary references and doesn't break
anything.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Evgeny Vereshchagin <evvers@ya.ru>
Cc: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Cc: Aditya Kali <adityakali@google.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: stable@vger.kernel.org # v4.6+
Fixes: a79a908fd2b0 ("cgroup: introduce cgroup namespaces")
Link: https://github.com/systemd/systemd/pull/3589#issuecomment-249089541
Diffstat (limited to 'drivers/regulator/internal.h')
0 files changed, 0 insertions, 0 deletions