]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
libperf evlist: Fix a refcount leak
authorIan Rogers <irogers@google.com>
Thu, 19 Mar 2020 02:31:01 +0000 (19:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:32:20 +0000 (09:32 +0200)
[ Upstream commit 4599d292128d89e4cf866a0ea9a9b047a2de8418 ]

Memory leaks found by applying LLVM's libfuzzer on the tools/perf
parse_events function.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: clang-built-linux@googlegroups.com
Link: http://lore.kernel.org/lkml/20200319023101.82458-2-irogers@google.com
[ Did a minor adjustment due to some other previous patch having already set evlist->all_cpus to NULL at perf_evlist__exit() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/perf/evlist.c

index 5b9f2ca50591dd2a5b5b79d24d4e4bee979c1d84..62130d28652db7309996dc30edf9d73d9f469909 100644 (file)
@@ -125,6 +125,7 @@ static void perf_evlist__purge(struct perf_evlist *evlist)
 void perf_evlist__exit(struct perf_evlist *evlist)
 {
        perf_cpu_map__put(evlist->cpus);
+       perf_cpu_map__put(evlist->all_cpus);
        perf_thread_map__put(evlist->threads);
        evlist->cpus = NULL;
        evlist->threads = NULL;