]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/perf-hist-add-missing-map__put-in-error-case.patch
autosel patches for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / perf-hist-add-missing-map__put-in-error-case.patch
1 From f7f9a261cb65ca08c1534adec405059d9777b41c Mon Sep 17 00:00:00 2001
2 From: Changbin Du <changbin.du@gmail.com>
3 Date: Sat, 16 Mar 2019 16:05:49 +0800
4 Subject: perf hist: Add missing map__put() in error case
5
6 [ Upstream commit cb6186aeffda4d27e56066c79e9579e7831541d3 ]
7
8 We need to map__put() before returning from failure of
9 sample__resolve_callchain().
10
11 Detected with gcc's ASan.
12
13 Signed-off-by: Changbin Du <changbin.du@gmail.com>
14 Reviewed-by: Jiri Olsa <jolsa@kernel.org>
15 Cc: Alexei Starovoitov <ast@kernel.org>
16 Cc: Daniel Borkmann <daniel@iogearbox.net>
17 Cc: Krister Johansen <kjlx@templeofstupid.com>
18 Cc: Namhyung Kim <namhyung@kernel.org>
19 Cc: Peter Zijlstra <peterz@infradead.org>
20 Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
21 Fixes: 9c68ae98c6f7 ("perf callchain: Reference count maps")
22 Link: http://lkml.kernel.org/r/20190316080556.3075-10-changbin.du@gmail.com
23 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
24 Signed-off-by: Sasha Levin <sashal@kernel.org>
25 ---
26 tools/perf/util/hist.c | 4 +++-
27 1 file changed, 3 insertions(+), 1 deletion(-)
28
29 diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
30 index 5d420209505e..5b8bc1fd943d 100644
31 --- a/tools/perf/util/hist.c
32 +++ b/tools/perf/util/hist.c
33 @@ -1040,8 +1040,10 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
34
35 err = sample__resolve_callchain(iter->sample, &callchain_cursor, &iter->parent,
36 iter->evsel, al, max_stack_depth);
37 - if (err)
38 + if (err) {
39 + map__put(alm);
40 return err;
41 + }
42
43 err = iter->ops->prepare_entry(iter, al);
44 if (err)
45 --
46 2.19.1
47