]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
cgroups: use task_lock() for access tsk->cgroups safe in cgroup_clone()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 8 Jan 2009 02:07:38 +0000 (18:07 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 8 Jan 2009 16:31:02 +0000 (08:31 -0800)
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>
kernel/cgroup.c

index a288da176e461fb2b0161ddff15b3e7f6cb7c34d..00d5136d38c23f1261e373a67981ebf6d0cc694e 100644 (file)
@@ -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 */