[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-e59d29e88f7b7e3d1231202b0203d0af6f15a440@git.kernel.org>
Date: Tue, 5 May 2015 21:36:58 -0700
From: tip-bot for Wang Nan <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: masami.hiramatsu.pt@...achi.com, acme@...hat.com, hpa@...or.com,
a.p.zijlstra@...llo.nl, wangnan0@...wei.com, dsahern@...il.com,
mingo@...nel.org, lizefan@...wei.com, jolsa@...nel.org,
paulus@...ba.org, linux-kernel@...r.kernel.org, tglx@...utronix.de
Subject: [tip:perf/urgent] perf probe: Fix segfault if passed with ''.
Commit-ID: e59d29e88f7b7e3d1231202b0203d0af6f15a440
Gitweb: http://git.kernel.org/tip/e59d29e88f7b7e3d1231202b0203d0af6f15a440
Author: Wang Nan <wangnan0@...wei.com>
AuthorDate: Tue, 28 Apr 2015 08:46:09 +0000
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 5 May 2015 12:26:52 -0300
perf probe: Fix segfault if passed with ''.
Since parse_perf_probe_point() deals with a user passed argument, we
should not assume it to be a valid string.
Without this patch, if pass '' to perf probe, a segfault raises:
$ perf probe -a ''
Segmentation fault
This patch checks argument of parse_perf_probe_point() before
string processing.
After this patch:
$ perf probe -a ''
usage: perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]
or: perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
...
Signed-off-by: Wang Nan <wangnan0@...wei.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Zefan Li <lizefan@...wei.com>
Link: http://lkml.kernel.org/r/1430210769-94177-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/probe-event.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index d8bb616..d05b77c 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1084,6 +1084,8 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
*
* TODO:Group name support
*/
+ if (!arg)
+ return -EINVAL;
ptr = strpbrk(arg, ";=@+%");
if (ptr && *ptr == '=') { /* Event name */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists