Skip to content

Commit 5b4dcd2

Browse files
mhiramatrostedt
authored andcommitted
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 <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: [email protected] Fixes: 2a588dd ("tracing: Add kprobe event command generation functions") Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent da0f1f4 commit 5b4dcd2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernel/trace/trace_kprobe.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);
940940
* complete command or only the first part of it; in the latter case,
941941
* kprobe_event_add_fields() can be used to add more fields following this.
942942
*
943+
* Unlikely the synth_event_gen_cmd_start(), @loc must be specified. This
944+
* returns -EINVAL if @loc == NULL.
945+
*
943946
* Return: 0 if successful, error otherwise.
944947
*/
945948
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,
953956
if (cmd->type != DYNEVENT_TYPE_KPROBE)
954957
return -EINVAL;
955958

959+
if (!loc)
960+
return -EINVAL;
961+
956962
if (kretprobe)
957963
snprintf(buf, MAX_EVENT_NAME_LEN, "r:kprobes/%s", name);
958964
else

0 commit comments

Comments
 (0)