Skip to content

Commit b5085b5

Browse files
mhiramatgregkh
authored andcommitted
tracing/trigger: Fix to return error if failed to alloc snapshot
commit 0958b33 upstream. Fix register_snapshot_trigger() to return error code if it failed to allocate a snapshot instead of 0 (success). Unless that, it will register snapshot trigger without an error. Link: https://lore.kernel.org/linux-trace-kernel/170622977792.270660.2789298642759362200.stgit@devnote2 Fixes: 0bbe7f7 ("tracing: Fix the race between registering 'snapshot' event trigger and triggering 'snapshot' operation") Cc: stable@vger.kernel.org Cc: Vincent Donnefort <vdonnefort@google.com> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cd459be commit b5085b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/trace/trace_events_trigger.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,8 +1161,10 @@ register_snapshot_trigger(char *glob, struct event_trigger_ops *ops,
11611161
struct event_trigger_data *data,
11621162
struct trace_event_file *file)
11631163
{
1164-
if (tracing_alloc_snapshot_instance(file->tr) != 0)
1165-
return 0;
1164+
int ret = tracing_alloc_snapshot_instance(file->tr);
1165+
1166+
if (ret < 0)
1167+
return ret;
11661168

11671169
return register_trigger(glob, ops, data, file);
11681170
}

0 commit comments

Comments
 (0)