]> Git Repo - linux.git/commitdiff
perf session: Fix infinite loop in __perf_session__process_events
authorArnaldo Carvalho de Melo <[email protected]>
Mon, 10 Jan 2011 23:37:57 +0000 (21:37 -0200)
committerArnaldo Carvalho de Melo <[email protected]>
Tue, 11 Jan 2011 00:23:08 +0000 (22:23 -0200)
In this if statement:

        if (head + event->header.size >= mmap_size) {
                if (mmaps[map_idx]) {
                        munmap(mmaps[map_idx], mmap_size);
                        mmaps[map_idx] = NULL;
                }

                page_offset = page_size * (head / page_size);
                file_offset += page_offset;
                head -= page_offset;
                goto remap;
        }

With, for instance, these values:

head=2992
event->header.size=48
mmap_size=3040

We end up endlessly looping back to remap. Off by one.

Problem introduced in 55b4462.

Reported-by: Linus Torvalds <[email protected]>
Reported-by: Ingo Molnar <[email protected]>
Reported-by: David Ahern <[email protected]>
Bisected-by: David Ahern <[email protected]>
Tested-by: David Ahern <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Tom Zanussi <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/session.c

index 6fb4694d05fa1e2c89e5ac91207c025214031f38..313dac2d94ce9f7c9e74ef0e8995383866427dbf 100644 (file)
@@ -1007,7 +1007,7 @@ more:
        if (size == 0)
                size = 8;
 
-       if (head + event->header.size >= mmap_size) {
+       if (head + event->header.size > mmap_size) {
                if (mmaps[map_idx]) {
                        munmap(mmaps[map_idx], mmap_size);
                        mmaps[map_idx] = NULL;
This page took 0.061734 seconds and 4 git commands to generate.