From: Sasha Levin <sasha.levin@oracle.com>
To: lizefan@huawei.com
Cc: linux-kernel@vger.kernel.org, Sasha Levin <sasha.levin@oracle.com>
Subject: [PATCH] cpuset: Add missing rcu read locks
Date: Thu, 27 Feb 2014 09:20:55 -0500 [thread overview]
Message-ID: <1393510855-8771-1-git-send-email-sasha.levin@oracle.com> (raw)
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
next reply other threads:[~2014-02-27 14:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-27 14:20 Sasha Levin [this message]
2014-03-03 8:32 ` Li Zefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393510855-8771-1-git-send-email-sasha.levin@oracle.com \
--to=sasha.levin@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®