From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 1/8] perf probe: Fix a segfault when removing uprobe events
Date: Mon, 21 Sep 2015 18:23:14 -0300 [thread overview]
Message-ID: <1442870601-26004-2-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1442870601-26004-1-git-send-email-acme@kernel.org>
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
next prev parent reply other threads:[~2015-09-21 21:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-21 21:23 [RFC 0/8] tools/build fixes related to eBPF support Arnaldo Carvalho de Melo
2015-09-21 21:23 ` Arnaldo Carvalho de Melo [this message]
2015-09-21 21:23 ` [PATCH 2/8] perf tools: Don't assume that the parser returns non empty evsel list Arnaldo Carvalho de Melo
2015-09-21 21:23 ` [PATCH 3/8] tools build: Fixup feature detection display function name Arnaldo Carvalho de Melo
2015-09-21 21:23 ` [PATCH 4/8] tools lib ebpf: Fix up FEATURE_{TESTS,DISPLAY} usage Arnaldo Carvalho de Melo
2015-09-21 21:23 ` [PATCH 5/8] tools build: Allow setting the feature detection user Arnaldo Carvalho de Melo
2015-09-22 6:51 ` Jiri Olsa
2015-09-22 13:02 ` Arnaldo Carvalho de Melo
2015-09-22 13:05 ` Arnaldo Carvalho de Melo
2015-09-21 21:23 ` [PATCH 6/8] tools lib bpf: Use FEATURE_USER to allow building in the same dir as perf Arnaldo Carvalho de Melo
2015-09-21 21:23 ` [PATCH 7/8] perf tools: Add include/err.h into MANIFEST Arnaldo Carvalho de Melo
2015-09-21 21:23 ` [PATCH 8/8] perf tools: Make perf depend on libbpf Arnaldo Carvalho de Melo
2015-09-22 7:02 ` Jiri Olsa
2015-09-22 13:12 ` Arnaldo Carvalho de Melo
2015-09-22 7:03 ` Jiri Olsa
2015-09-22 13:18 ` Arnaldo Carvalho de Melo
2015-09-22 13:31 ` Jiri Olsa
2015-09-22 13:40 ` Arnaldo Carvalho de Melo
2015-09-22 13:55 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442870601-26004-2-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox