Skip to content

Commit 091aaf3

Browse files
tracing/trigger: Fix to return error if failed to alloc snapshot
JIRA: https://issues.redhat.com/browse/RHEL-33284 CVE: CVE-2024-26920 commit b5085b5 Author: Masami Hiramatsu (Google) <mhiramat@kernel.org> Date: Fri Jan 26 09:42:58 2024 +0900 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> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
1 parent afc1e64 commit 091aaf3

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
@@ -1108,8 +1108,10 @@ register_snapshot_trigger(char *glob, struct event_trigger_ops *ops,
11081108
struct event_trigger_data *data,
11091109
struct trace_event_file *file)
11101110
{
1111-
if (tracing_alloc_snapshot_instance(file->tr) != 0)
1112-
return 0;
1111+
int ret = tracing_alloc_snapshot_instance(file->tr);
1112+
1113+
if (ret < 0)
1114+
return ret;
11131115

11141116
return register_trigger(glob, ops, data, file);
11151117
}

0 commit comments

Comments
 (0)