Skip to content

Commit

Permalink
ftrace: Fix t_hash_start()
Browse files Browse the repository at this point in the history
When the output of set_ftrace_filter is larger than PAGE_SIZE,
t_hash_start() will be called the 2nd time, and then we start
from the head of a hlist, which is wrong and causes some entries
to be outputed twice.

The worse is, if the hlist is large enough, reading set_ftrace_filter
won't stop but in a dead loop.

Reviewed-by: Liming Wang <liming.wang@windriver.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4A41876E.2060407@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Jun 24, 2009
1 parent 694ce0a commit d82d624
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,10 +1417,20 @@ static void *t_hash_start(struct seq_file *m, loff_t *pos)
{
struct ftrace_iterator *iter = m->private;
void *p = NULL;
loff_t l;

if (!(iter->flags & FTRACE_ITER_HASH))
*pos = 0;

iter->flags |= FTRACE_ITER_HASH;

return t_hash_next(m, p, pos);
iter->hidx = 0;
for (l = 0; l <= *pos; ) {
p = t_hash_next(m, p, &l);
if (!p)
break;
}
return p;
}

static int t_hash_show(struct seq_file *m, void *v)
Expand Down

0 comments on commit d82d624

Please sign in to comment.