* [PATCH] cpuset: Add missing rcu read locks
@ 2014-02-27 14:20 Sasha Levin
2014-03-03 8:32 ` Li Zefan
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2014-02-27 14:20 UTC (permalink / raw)
To: lizefan; +Cc: linux-kernel, Sasha Levin
We call task_cs() which ends up going into cgroup code without having rcu
read lock. Fix it by grabbing the lock before retrival of task_cs() and usage
of the result.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
kernel/cpuset.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index be9c1da..64bd8a4 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2240,8 +2240,10 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask)
mutex_lock(&callback_mutex);
task_lock(tsk);
+ rcu_read_lock();
cpus_cs = effective_cpumask_cpuset(task_cs(tsk));
guarantee_online_cpus(cpus_cs, pmask);
+ rcu_read_unlock();
task_unlock(tsk);
mutex_unlock(&callback_mutex);
}
@@ -2296,8 +2298,10 @@ nodemask_t cpuset_mems_allowed(struct task_struct *tsk)
mutex_lock(&callback_mutex);
task_lock(tsk);
+ rcu_read_lock();
mems_cs = effective_nodemask_cpuset(task_cs(tsk));
guarantee_online_mems(mems_cs, &mask);
+ rcu_read_unlock();
task_unlock(tsk);
mutex_unlock(&callback_mutex);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cpuset: Add missing rcu read locks
2014-02-27 14:20 [PATCH] cpuset: Add missing rcu read locks Sasha Levin
@ 2014-03-03 8:32 ` Li Zefan
0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2014-03-03 8:32 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel
On 2014/2/27 22:20, Sasha Levin wrote:
> We call task_cs() which ends up going into cgroup code without having rcu
> read lock. Fix it by grabbing the lock before retrival of task_cs() and usage
> of the result.
>
Thanks for the patch.
Fengguang already reported it, and I've made a patch for it, but I was fixing
two bugs for 3.14 and then waiting for them to be applied.
There're other places that rcu_read_lock() should be used, and we need to
remove task_lock().
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-03 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-27 14:20 [PATCH] cpuset: Add missing rcu read locks Sasha Levin
2014-03-03 8:32 ` Li Zefan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox