Skip to content

Commit 9bbb332

Browse files
Tom Zanussirostedt
authored andcommitted
tracing: Check that the synthetic event and field names are legal
Call the is_good_name() function used by probe events to make sure synthetic event and field names don't contain illegal characters and cause unexpected parsing of synthetic event commands. Link: https://lkml.kernel.org/r/c4d4bb59d3ac39bcbd70fba0cf837d6b1cedb015.1602598160.git.zanussi@kernel.org Fixes: 4b14793 (tracing: Add support for 'synthetic' events) Reported-by: Masami Hiramatsu <mhiramat@kernel.org> Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> Tested-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Tom Zanussi <zanussi@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 42d120e commit 9bbb332

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

kernel/trace/trace_events_synth.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
572572
ret = -ENOMEM;
573573
goto free;
574574
}
575+
if (!is_good_name(field->name)) {
576+
ret = -EINVAL;
577+
goto free;
578+
}
575579

576580
if (field_type[0] == ';')
577581
field_type++;
@@ -1112,6 +1116,11 @@ static int __create_synth_event(int argc, const char *name, const char **argv)
11121116

11131117
mutex_lock(&event_mutex);
11141118

1119+
if (!is_good_name(name)) {
1120+
ret = -EINVAL;
1121+
goto out;
1122+
}
1123+
11151124
event = find_synth_event(name);
11161125
if (event) {
11171126
ret = -EEXIST;

0 commit comments

Comments
 (0)