]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-3.18/perf-top-fix-error-handling-in-cmd_top.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / queue-3.18 / perf-top-fix-error-handling-in-cmd_top.patch
1 From 4835e4a81038bdf70395cda374c437222e487a13 Mon Sep 17 00:00:00 2001
2 From: Changbin Du <changbin.du@gmail.com>
3 Date: Sat, 16 Mar 2019 16:05:48 +0800
4 Subject: perf top: Fix error handling in cmd_top()
5
6 [ Upstream commit 70c819e4bf1c5f492768b399d898d458ccdad2b6 ]
7
8 We should go to the cleanup path, to avoid leaks, detected using gcc's
9 ASan.
10
11 Signed-off-by: Changbin Du <changbin.du@gmail.com>
12 Reviewed-by: Jiri Olsa <jolsa@kernel.org>
13 Cc: Alexei Starovoitov <ast@kernel.org>
14 Cc: Daniel Borkmann <daniel@iogearbox.net>
15 Cc: Namhyung Kim <namhyung@kernel.org>
16 Cc: Peter Zijlstra <peterz@infradead.org>
17 Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
18 Link: http://lkml.kernel.org/r/20190316080556.3075-9-changbin.du@gmail.com
19 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
20 Signed-off-by: Sasha Levin <sashal@kernel.org>
21 ---
22 tools/perf/builtin-top.c | 5 +++--
23 1 file changed, 3 insertions(+), 2 deletions(-)
24
25 diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
26 index c5b9c3f01d85..ea02883c3405 100644
27 --- a/tools/perf/builtin-top.c
28 +++ b/tools/perf/builtin-top.c
29 @@ -1256,8 +1256,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
30 symbol_conf.priv_size = sizeof(struct annotation);
31
32 symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
33 - if (symbol__init(NULL) < 0)
34 - return -1;
35 + status = symbol__init(NULL);
36 + if (status < 0)
37 + goto out_delete_evlist;
38
39 sort__setup_elide(stdout);
40
41 --
42 2.19.1
43