Skip to content

Commit 0958b33

Browse files
mhiramatrostedt
authored andcommitted
tracing/trigger: Fix to return error if failed to alloc snapshot
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: [email protected] Cc: Vincent Donnefort <[email protected]> Signed-off-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 834bf76 commit 0958b33

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
@@ -1470,8 +1470,10 @@ register_snapshot_trigger(char *glob,
14701470
struct event_trigger_data *data,
14711471
struct trace_event_file *file)
14721472
{
1473-
if (tracing_alloc_snapshot_instance(file->tr) != 0)
1474-
return 0;
1473+
int ret = tracing_alloc_snapshot_instance(file->tr);
1474+
1475+
if (ret < 0)
1476+
return ret;
14751477

14761478
return register_trigger(glob, data, file);
14771479
}

0 commit comments

Comments
 (0)