diff options
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 3948f0a..460aa1b 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -366,10 +366,18 @@ static void free_css_set_work(struct work_struct *work) struct cgroup *cgrp = link->cgrp; list_del(&link->cg_link_list); list_del(&link->cgrp_link_list); + /* + * We may not be holding cgroup_mutex, and if cgrp->count is + * dropped to 0 the cgroup can be destroyed at any time, hence + * rcu_read_lock is used to keep it alive. + */ + rcu_read_lock(); if (atomic_dec_and_test(&cgrp->count)) { check_for_release(cgrp); cgroup_wakeup_rmdir_waiter(cgrp); } + rcu_read_unlock(); + kfree(link); } write_unlock(&css_set_lock); |