summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2009-01-07 18:07:38 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 08:31:02 -0800
commit104cbd55377029e70fc2cee01089e84b9c36e5dc (patch)
tree60c7d0d9625b74f6a2733a9618cc97dc772848f5 /kernel/cgroup.c
parentb2aa30f7bb381e04c93eed106089ba55553955f1 (diff)
downloadlinux-104cbd55377029e70fc2cee01089e84b9c36e5dc.tar.gz
linux-104cbd55377029e70fc2cee01089e84b9c36e5dc.tar.bz2
linux-104cbd55377029e70fc2cee01089e84b9c36e5dc.zip
cgroups: use task_lock() for access tsk->cgroups safe in cgroup_clone()
Use task_lock() protect tsk->cgroups and get_css_set(tsk->cgroups). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Acked-by: Paul Menage <menage@google.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: Balbir Singh <balbir@in.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a288da176e46..00d5136d38c2 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2903,6 +2903,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
mutex_unlock(&cgroup_mutex);
return 0;
}
+ task_lock(tsk);
cg = tsk->cgroups;
parent = task_cgroup(tsk, subsys->subsys_id);
@@ -2915,6 +2916,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
/* Keep the cgroup alive */
get_css_set(cg);
+ task_unlock(tsk);
mutex_unlock(&cgroup_mutex);
/* Now do the VFS work to create a cgroup */