]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "tracing/trigger: Fix to return error if failed to alloc snapshot"
authorSiddh Raman Pant <siddh.raman.pant@oracle.com>
Thu, 18 Apr 2024 13:28:06 +0000 (18:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 May 2024 14:18:30 +0000 (16:18 +0200)
This reverts commit 8ffd5590f4d6ef5460acbeac7fbdff7025f9b419 which is
commit 0958b33ef5a04ed91f61cef4760ac412080c4e08 upstream.

The change has an incorrect assumption about the return value because
in the current stable trees for versions 5.15 and before, the following
commit responsible for making 0 a success value is not present:
b8cc44a4d3c1 ("tracing: Remove logic for registering multiple event triggers at a time")

The return value should be 0 on failure in the current tree, because in
the functions event_trigger_callback() and event_enable_trigger_func(),
we have:

ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
/*
 * The above returns on success the # of functions enabled,
 * but if it didn't find any functions it returns zero.
 * Consider no functions a failure too.
 */
if (!ret) {
ret = -ENOENT;

Cc: stable@kernel.org # 5.15, 5.10, 5.4, 4.19
Signed-off-by: Siddh Raman Pant <siddh.raman.pant@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/trace_events_trigger.c

index 634d120eab2b16a4dd31a2c7806b6bcdca3113e8..82580f7ffad952e5ba4d928ff52d9fff78afa7dd 100644 (file)
@@ -1140,10 +1140,8 @@ register_snapshot_trigger(char *glob, struct event_trigger_ops *ops,
                          struct event_trigger_data *data,
                          struct trace_event_file *file)
 {
-       int ret = tracing_alloc_snapshot_instance(file->tr);
-
-       if (ret < 0)
-               return ret;
+       if (tracing_alloc_snapshot_instance(file->tr) != 0)
+               return 0;
 
        return register_trigger(glob, ops, data, file);
 }