]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER
authorGabriele Paoloni <gpaoloni@redhat.com>
Fri, 21 Mar 2025 17:08:21 +0000 (18:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:17:46 +0000 (10:17 +0200)
[ Upstream commit 0c588ac0ca6c22b774d9ad4a6594681fdfa57d9d ]

When __ftrace_event_enable_disable invokes the class callback to
unregister the event, the return value is not reported up to the
caller, hence leading to event unregister failures being silently
ignored.

This patch assigns the ret variable to the invocation of the
event unregister callback, so that its return value is stored
and reported to the caller, and it raises a warning in case
of error.

Link: https://lore.kernel.org/20250321170821.101403-1-gpaoloni@redhat.com
Signed-off-by: Gabriele Paoloni <gpaoloni@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/trace_events.c

index 44d8549522501c2b5e0cc9cbe6363be23175ec2e..a1cf3dae9a62da6ead5151a2a2d9310e2563cc9c 100644 (file)
@@ -797,7 +797,9 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,
                                clear_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags);
                        }
 
-                       call->class->reg(call, TRACE_REG_UNREGISTER, file);
+                       ret = call->class->reg(call, TRACE_REG_UNREGISTER, file);
+
+                       WARN_ON_ONCE(ret);
                }
                /* If in SOFT_MODE, just set the SOFT_DISABLE_BIT, else clear it */
                if (file->flags & EVENT_FILE_FL_SOFT_MODE)