diff options
author | Abhishek Sagar <sagar.abhishek@gmail.com> | 2008-05-24 14:15:02 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-26 16:52:04 -0400 |
commit | ffdaa3582b6b39d625d585d07e329ffdc925e971 (patch) | |
tree | 2e75b26ea065d6e11eeb17b8ea77bcd2f16853c6 /kernel | |
parent | ccbfac2923c9febaeaf07a50054027a92b502718 (diff) |
ftrace: safe traversal of ftrace_hash hlist
Hi Steven,
I noticed that concurrent instances of ftrace_record_ip()
have a race between ftrace_hash list traversal during
ftrace_ip_in_hash() (before acquiring ftrace_shutdown_lock)
and ftrace_add_hash(). If it's so then this should fix it.
Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com>
Cc: rostedt@goodmis.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ftrace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 2552454609cf..9b7c54f8a62f 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -201,7 +201,7 @@ ftrace_ip_in_hash(unsigned long ip, unsigned long key) | |||
201 | struct hlist_node *t; | 201 | struct hlist_node *t; |
202 | int found = 0; | 202 | int found = 0; |
203 | 203 | ||
204 | hlist_for_each_entry(p, t, &ftrace_hash[key], node) { | 204 | hlist_for_each_entry_rcu(p, t, &ftrace_hash[key], node) { |
205 | if (p->ip == ip) { | 205 | if (p->ip == ip) { |
206 | found = 1; | 206 | found = 1; |
207 | break; | 207 | break; |
@@ -214,7 +214,7 @@ ftrace_ip_in_hash(unsigned long ip, unsigned long key) | |||
214 | static inline void | 214 | static inline void |
215 | ftrace_add_hash(struct dyn_ftrace *node, unsigned long key) | 215 | ftrace_add_hash(struct dyn_ftrace *node, unsigned long key) |
216 | { | 216 | { |
217 | hlist_add_head(&node->node, &ftrace_hash[key]); | 217 | hlist_add_head_rcu(&node->node, &ftrace_hash[key]); |
218 | } | 218 | } |
219 | 219 | ||
220 | static void ftrace_free_rec(struct dyn_ftrace *rec) | 220 | static void ftrace_free_rec(struct dyn_ftrace *rec) |