From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: [PATCH 5/8] tracing/probe: Check event name length correctly
Date: Fri, 15 Mar 2019 14:45:10 -0400 [thread overview]
Message-ID: <20190315184536.904473843@goodmis.org> (raw)
In-Reply-To: <20190315184505.655928086@goodmis.org>
From: Masami Hiramatsu <mhiramat@kernel.org>
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.
Link: http://lkml.kernel.org/r/155253782046.14922.14724124823730168629.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.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 cfcf77e6fb19..0dc13bff2847 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;
}
--
2.20.1
next prev parent reply other threads:[~2019-03-15 18:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 18:45 [PATCH 0/8] [GIT PULL] tracing: Minor clean ups, fixes and error checking Steven Rostedt
2019-03-15 18:45 ` [PATCH 1/8] tracing/probes: Make reserved_field_names static Steven Rostedt
2019-03-15 18:45 ` [PATCH 2/8] trace/probes: Remove kernel doc style from non kernel doc comment Steven Rostedt
2019-03-15 18:45 ` [PATCH 3/8] tracing: kdb: Fix ftdump to not sleep Steven Rostedt
2019-03-15 18:45 ` [PATCH 4/8] tracing/probe: Check maxactive error cases Steven Rostedt
2019-03-15 18:45 ` Steven Rostedt [this message]
2019-03-15 18:45 ` [PATCH 6/8] tracing/probe: Check the size of argument name and body Steven Rostedt
2019-03-15 18:45 ` [PATCH 7/8] tracing/probe: Check event/group naming rule at parsing Steven Rostedt
2019-03-15 18:45 ` [PATCH 8/8] tracing/probe: Verify alloc_trace_*probe() result Steven Rostedt
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=20190315184536.904473843@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=torvalds@linux-foundation.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
Powered by JetHome