summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-08-02 18:59:28 -0300
committerAK <andi@firstfloor.org>2011-03-31 11:57:35 -0700
commit04c0aca8ff980e0654d4b4f519cab8da7ede638e (patch)
tree5ae801aff989f953567580f1353a4996c509ae7c /tools/perf
parentd6c90f5b218c1ddf1496045e3939b1c960c7cb9f (diff)
perf session: Invalidate last_match when removing threads from rb_tree
[ upstream commit 70597f21f128b7dd6a2490078bea99d704b6f8c3 ] If we receive two PERF_RECORD_EXIT for the same thread, we can end up reusing session->last_match and trying to remove the thread twice from the rb_tree, causing a segfault, so invalidade last_match in perf_session__remove_thread. Receiving two PERF_RECORD_EXIT for the same thread is a bug, but its a harmless one if we make the tool more robust, like this patch does. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/session.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index c422cd676313..af094a20505d 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -134,6 +134,7 @@ void perf_session__delete(struct perf_session *self)
void perf_session__remove_thread(struct perf_session *self, struct thread *th)
{
+ self->last_match = NULL;
rb_erase(&th->rb_node, &self->threads);
/*
* We may have references to this thread, for instance in some hist_entry