]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/perf-list-don-t-forget-to-drop-the-reference-to-the-.patch
autosel patches for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / perf-list-don-t-forget-to-drop-the-reference-to-the-.patch
1 From 0ad0ac2260addf458767c5a573e3b2cce42613a9 Mon Sep 17 00:00:00 2001
2 From: Changbin Du <changbin.du@gmail.com>
3 Date: Sat, 16 Mar 2019 16:05:42 +0800
4 Subject: perf list: Don't forget to drop the reference to the allocated
5 thread_map
6
7 [ Upstream commit 39df730b09774bd860e39ea208a48d15078236cb ]
8
9 Detected via gcc's ASan:
10
11 Direct leak of 2048 byte(s) in 64 object(s) allocated from:
12 6 #0 0x7f606512e370 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee370)
13 7 #1 0x556b0f1d7ddd in thread_map__realloc util/thread_map.c:43
14 8 #2 0x556b0f1d84c7 in thread_map__new_by_tid util/thread_map.c:85
15 9 #3 0x556b0f0e045e in is_event_supported util/parse-events.c:2250
16 10 #4 0x556b0f0e1aa1 in print_hwcache_events util/parse-events.c:2382
17 11 #5 0x556b0f0e3231 in print_events util/parse-events.c:2514
18 12 #6 0x556b0ee0a66e in cmd_list /home/changbin/work/linux/tools/perf/builtin-list.c:58
19 13 #7 0x556b0f01e0ae in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
20 14 #8 0x556b0f01e859 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
21 15 #9 0x556b0f01edc8 in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
22 16 #10 0x556b0f01f71f in main /home/changbin/work/linux/tools/perf/perf.c:520
23 17 #11 0x7f6062ccf09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
24
25 Signed-off-by: Changbin Du <changbin.du@gmail.com>
26 Reviewed-by: Jiri Olsa <jolsa@kernel.org>
27 Cc: Alexei Starovoitov <ast@kernel.org>
28 Cc: Daniel Borkmann <daniel@iogearbox.net>
29 Cc: Namhyung Kim <namhyung@kernel.org>
30 Cc: Peter Zijlstra <peterz@infradead.org>
31 Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
32 Fixes: 89896051f8da ("perf tools: Do not put a variable sized type not at the end of a struct")
33 Link: http://lkml.kernel.org/r/20190316080556.3075-3-changbin.du@gmail.com
34 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
35 Signed-off-by: Sasha Levin <sashal@kernel.org>
36 ---
37 tools/perf/util/parse-events.c | 1 +
38 1 file changed, 1 insertion(+)
39
40 diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
41 index d0b92d374ba9..ec3517326a68 100644
42 --- a/tools/perf/util/parse-events.c
43 +++ b/tools/perf/util/parse-events.c
44 @@ -2109,6 +2109,7 @@ static bool is_event_supported(u8 type, unsigned config)
45 perf_evsel__delete(evsel);
46 }
47
48 + thread_map__put(tmap);
49 return ret;
50 }
51
52 --
53 2.19.1
54