Skip to content

Commit b4443c1

Browse files
mhiramatrostedt
authored andcommitted
tracing/probe: Check the size of argument name and body
Check the size of argument name and expression is not 0 and smaller than maximum length. Link: http://lkml.kernel.org/r/155253783029.14922.12650939303827581096.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent dec65d7 commit b4443c1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

kernel/trace/trace_probe.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ int traceprobe_parse_probe_arg(struct trace_probe *tp, int i, char *arg,
554554

555555
body = strchr(arg, '=');
556556
if (body) {
557+
if (body - arg > MAX_ARG_NAME_LEN || body == arg)
558+
return -EINVAL;
557559
parg->name = kmemdup_nul(arg, body - arg, GFP_KERNEL);
558560
body++;
559561
} else {

kernel/trace/trace_probe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define MAX_TRACE_ARGS 128
3333
#define MAX_ARGSTR_LEN 63
3434
#define MAX_ARRAY_LEN 64
35+
#define MAX_ARG_NAME_LEN 32
3536
#define MAX_STRING_SIZE PATH_MAX
3637

3738
/* Reserved field names */

0 commit comments

Comments
 (0)