Commit 5b4dcd2d authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Steven Rostedt (VMware)

tracing/kprobes: Reject new event if loc is NULL

Reject the new event which has NULL location for kprobes.
For kprobes, user must specify at least the location.

Link: http://lkml.kernel.org/r/158779376597.6082.1411212055469099461.stgit@devnote2

Cc: Tom Zanussi <zanussi@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 2a588dd1 ("tracing: Add kprobe event command generation functions")
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent da0f1f41
...@@ -940,6 +940,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init); ...@@ -940,6 +940,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);
* complete command or only the first part of it; in the latter case, * complete command or only the first part of it; in the latter case,
* kprobe_event_add_fields() can be used to add more fields following this. * kprobe_event_add_fields() can be used to add more fields following this.
* *
* Unlikely the synth_event_gen_cmd_start(), @loc must be specified. This
* returns -EINVAL if @loc == NULL.
*
* Return: 0 if successful, error otherwise. * Return: 0 if successful, error otherwise.
*/ */
int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe, int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe,
...@@ -953,6 +956,9 @@ int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe, ...@@ -953,6 +956,9 @@ int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe,
if (cmd->type != DYNEVENT_TYPE_KPROBE) if (cmd->type != DYNEVENT_TYPE_KPROBE)
return -EINVAL; return -EINVAL;
if (!loc)
return -EINVAL;
if (kretprobe) if (kretprobe)
snprintf(buf, MAX_EVENT_NAME_LEN, "r:kprobes/%s", name); snprintf(buf, MAX_EVENT_NAME_LEN, "r:kprobes/%s", name);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment