summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2009-02-03 20:39:04 +0100
committerIngo Molnar <mingo@elte.hu>2009-02-03 22:50:58 +0100
commit229c4ef8ae56d69f8dec64533bf1c7f8070c1a4a (patch)
treee13a9ef3602f945ae51b73b592c8ae4d29e67ca3 /kernel
parentb1792e367053968f2ddb48bc911d314143ce6242 (diff)
downloadlinux-stable-229c4ef8ae56d69f8dec64533bf1c7f8070c1a4a.tar.gz
linux-stable-229c4ef8ae56d69f8dec64533bf1c7f8070c1a4a.tar.bz2
linux-stable-229c4ef8ae56d69f8dec64533bf1c7f8070c1a4a.zip
ftrace: do_each_pid_task() needs rcu lock
"ftrace: use struct pid" commit 978f3a45d9499c7a447ca7615455cefb63d44165 converted ftrace_pid_trace to "struct pid*". But we can't use do_each_pid_task() without rcu_read_lock() even if we know the pid itself can't go away (it was pinned in ftrace_pid_write). The exiting task can detach itself from this pid at any moment. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ftrace.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7dcf6e9f2b04..9a236ffe2aa4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1737,9 +1737,12 @@ static void clear_ftrace_pid(struct pid *pid)
{
struct task_struct *p;
+ rcu_read_lock();
do_each_pid_task(pid, PIDTYPE_PID, p) {
clear_tsk_trace_trace(p);
} while_each_pid_task(pid, PIDTYPE_PID, p);
+ rcu_read_unlock();
+
put_pid(pid);
}
@@ -1747,9 +1750,11 @@ static void set_ftrace_pid(struct pid *pid)
{
struct task_struct *p;
+ rcu_read_lock();
do_each_pid_task(pid, PIDTYPE_PID, p) {
set_tsk_trace_trace(p);
} while_each_pid_task(pid, PIDTYPE_PID, p);
+ rcu_read_unlock();
}
static void clear_ftrace_pid_task(struct pid **pid)