From: Arnaldo Carvalho de Melo Date: Fri, 25 Oct 2019 18:14:50 +0000 (-0300) Subject: perf map: Check if the map still has some refcounts on exit X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ee2555b612869a763563c5389ad789a52db0afd1;p=linux.git perf map: Check if the map still has some refcounts on exit We were checking just if it was still on some rb tree, but that is not the only way that this map can still have references, map->refcnt is there exactly for this, use it. Cc: Adrian Hunter Cc: Andi Kleen Cc: Jiri Olsa Cc: Namhyung Kim Link: https://lkml.kernel.org/n/tip-hany65tbeavsax7n3xvwl9pc@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index eec9b282c0479..c9ba49566981e 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -288,7 +288,7 @@ bool map__has_symbols(const struct map *map) static void map__exit(struct map *map) { - BUG_ON(!RB_EMPTY_NODE(&map->rb_node)); + BUG_ON(refcount_read(&map->refcnt) != 0); dso__zput(map->dso); }