Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1231103

[PATCH 1/9] perf probe: Fix a segfault when removing uprobe events

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 1/9] perf probe: Fix a segfault when removing uprobe events
Date 2015-09-23 04:20 +0200
Message-ID <qbHP3-7ct-17@gated-at.bofh.it> (permalink)
References <qbHP3-7ct-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Fix a segfault bug and a small mistake in perf probe -d.

Since the "ulist" in perf_del_probe_events is never initialized,
strlist__add(ulist, *) always causes a segfault when removing
uprobe events by perf probe -d.

Also, the "str" local variable is never released if fail to
allocate the "klist". This fixes it too.

This has been introduced by the commit e607f1426b58 ("perf probe:
Print deleted events in cmd_probe()").

Reported-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20150916125241.4446.44805.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-probe.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 94385ee89dc8..f7882ae9ebc6 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter)
 		goto out;
 
 	klist = strlist__new(NULL, NULL);
-	if (!klist)
-		return -ENOMEM;
+	ulist = strlist__new(NULL, NULL);
+	if (!klist || !ulist) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	ret = probe_file__get_events(kfd, filter, klist);
 	if (ret == 0) {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 0/9] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  [PATCH 6/9] tools lib bpf: Use FEATURE_USER to allow building in the same dir as perf Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  [PATCH 4/9] tools lib bpf: Fix up FEATURE_{TESTS,DISPLAY} usage Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  [PATCH 1/9] perf probe: Fix a segfault when removing uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  [PATCH 8/9] tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  [PATCH 7/9] perf tools: Add include/err.h into MANIFEST Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  [PATCH 3/9] tools build: Fixup feature detection display function name Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  [PATCH 2/9] perf tools: Don't assume that the parser returns non empty evsel list Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  [PATCH 9/9] perf record: Synthesize COMM event for a command line workload Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
  Re: [GIT PULL 0/9] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2015-09-23 09:50 +0200

csiph-web