summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2017-05-15 09:34:06 -0400
committerTejun Heo <tj@kernel.org>2017-05-17 16:58:32 -0400
commit33c35aa4817864e056fd772230b0c6b552e36ea2 (patch)
treec5eea540e4e818e11aa809d7652cface407203e7 /kernel
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
downloadop-kernel-dev-33c35aa4817864e056fd772230b0c6b552e36ea2.zip
op-kernel-dev-33c35aa4817864e056fd772230b0c6b552e36ea2.tar.gz
cgroup: Prevent kill_css() from being called more than once
The kill_css() function may be called more than once under the condition that the css was killed but not physically removed yet followed by the removal of the cgroup that is hosting the css. This patch prevents any harmm from being done when that happens. Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org # v4.5+
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup/cgroup.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index c3c9a0e..8d4e85e 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4265,6 +4265,11 @@ static void kill_css(struct cgroup_subsys_state *css)
{
lockdep_assert_held(&cgroup_mutex);
+ if (css->flags & CSS_DYING)
+ return;
+
+ css->flags |= CSS_DYING;
+
/*
* This must happen before css is disassociated with its cgroup.
* See seq_css() for details.
OpenPOWER on IntegriCloud