]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.0/perf-map-remove-map-from-names-tree-in-__maps__remov.patch
autosel patches for 5.0
[thirdparty/kernel/stable-queue.git] / queue-5.0 / perf-map-remove-map-from-names-tree-in-__maps__remov.patch
1 From 66e96c25d02945347952a61abe52a15b0e9a626b Mon Sep 17 00:00:00 2001
2 From: Changbin Du <changbin.du@gmail.com>
3 Date: Sat, 16 Mar 2019 16:05:50 +0800
4 Subject: perf map: Remove map from 'names' tree in __maps__remove()
5
6 [ Upstream commit b49265e04410b97b31a5ee66ef6782c1b2d6cd2c ]
7
8 There are two trees for each map inserted by maps__insert(), so remove
9 it from the 'names' tree in __maps__remove().
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: Eric Saint-Etienne <eric.saint.etienne@oracle.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: 1e6285699b30 ("perf symbols: Fix slowness due to -ffunction-section")
22 Link: http://lkml.kernel.org/r/20190316080556.3075-11-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/map.c | 3 +++
27 1 file changed, 3 insertions(+)
28
29 diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
30 index 6751301a755c..750ecc3dad50 100644
31 --- a/tools/perf/util/map.c
32 +++ b/tools/perf/util/map.c
33 @@ -911,6 +911,9 @@ static void __maps__remove(struct maps *maps, struct map *map)
34 {
35 rb_erase_init(&map->rb_node, &maps->entries);
36 map__put(map);
37 +
38 + rb_erase_init(&map->rb_node_name, &maps->names);
39 + map__put(map);
40 }
41
42 void maps__remove(struct maps *maps, struct map *map)
43 --
44 2.19.1
45