summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorWang Nan2015-05-17 12:56:27 +0200
committerArnaldo Carvalho de Melo2015-05-18 15:17:39 +0200
commitc4f035473d93c1594d8225f6dd97332317820801 (patch)
tree4032236ac800b902aa7a603aca6e9d6cea5f170a /tools/perf/util
parentperf tools: Protect dso cache fd with a mutex (diff)
downloadkernel-qcow2-linux-c4f035473d93c1594d8225f6dd97332317820801.tar.gz
kernel-qcow2-linux-c4f035473d93c1594d8225f6dd97332317820801.tar.xz
kernel-qcow2-linux-c4f035473d93c1594d8225f6dd97332317820801.zip
perf tools: Set vmlinux_path__nr_entries to 0 in vmlinux_path__exit
Original vmlinux_path__exit() doesn't revert vmlinux_path__nr_entries to its original state. After the while loop vmlinux_path__nr_entries becomes -1 instead of 0. This makes a problem that, if runs twice, during the second run vmlinux_path__init() will set vmlinux_path[-1] to strdup("vmlinux"), corrupts random memory. This patch reset vmlinux_path__nr_entries to 0 after the while loop. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexei Starovoitov <ast@plumgrid.com Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: pi3orama@163.com Cc: Zefan Li <lizefan@huawei.com> Link: http://lkml.kernel.org/r/1431860222-61636-3-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/symbol.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 9ef8b8946b11..82a31fd0fcf5 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1819,6 +1819,7 @@ static void vmlinux_path__exit(void)
{
while (--vmlinux_path__nr_entries >= 0)
zfree(&vmlinux_path[vmlinux_path__nr_entries]);
+ vmlinux_path__nr_entries = 0;
zfree(&vmlinux_path);
}