[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <155253782046.14922.14724124823730168629.stgit@devnote2>
Date: Thu, 14 Mar 2019 13:30:20 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Tom Zanussi <zanussi@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>
Cc: tglx@...utronix.de, mhiramat@...nel.org, namhyung@...nel.org,
bigeasy@...utronix.de, joel@...lfernandes.org,
linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org
Subject: [RFC PATCH v2 2/7] tracing/probe: Check event name length correctly
Ensure given name of event is not too long when parsing it,
and fix to update event name offset correctly when the group
name is given. For example, this makes probe event to check
the "p:foo/" error case correctly.
Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
kernel/trace/trace_probe.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 89da34b326e3..4cd50913cb5d 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -159,6 +159,7 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
char *buf)
{
const char *slash, *event = *pevent;
+ int len;
slash = strchr(event, '/');
if (slash) {
@@ -173,10 +174,15 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
strlcpy(buf, event, slash - event + 1);
*pgroup = buf;
*pevent = slash + 1;
+ event = *pevent;
}
- if (strlen(event) == 0) {
+ len = strlen(event);
+ if (len == 0) {
pr_info("Event name is not specified\n");
return -EINVAL;
+ } else if (len > MAX_EVENT_NAME_LEN) {
+ pr_info("Event name is too long\n");
+ return -E2BIG;
}
return 0;
}
Powered by blists - more mailing lists