From: Li Zefan Date: Wed, 23 Mar 2011 23:42:48 +0000 (-0700) Subject: cpuset: hold callback_mutex in cpuset_post_clone() X-Git-Tag: v2.6.39-rc1~140 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=523fb486bfd94e3a3b16a42bcb21b1959cf14df8;p=~shefty%2Frdma-dev.git cpuset: hold callback_mutex in cpuset_post_clone() Chaning cpuset->mems/cpuset->cpus should be protected under callback_mutex. cpuset_clone() doesn't follow this rule. It's ok because it's called when creating and initializing a cgroup, but we'd better hold the lock to avoid subtil break in the future. Signed-off-by: Li Zefan Acked-by: Paul Menage Acked-by: David Rientjes Cc: Miao Xie Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/cpuset.c b/kernel/cpuset.c index e472fe13919..33eee16addb 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -1840,8 +1840,10 @@ static void cpuset_post_clone(struct cgroup_subsys *ss, cs = cgroup_cs(cgroup); parent_cs = cgroup_cs(parent); + mutex_lock(&callback_mutex); cs->mems_allowed = parent_cs->mems_allowed; cpumask_copy(cs->cpus_allowed, parent_cs->cpus_allowed); + mutex_unlock(&callback_mutex); return; }