]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tracing: Ensure module defining synth event cannot be unloaded while tracing
authorDouglas Raillard <douglas.raillard@arm.com>
Tue, 18 Mar 2025 18:09:05 +0000 (18:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:32:06 +0000 (14:32 +0200)
commitcaefd40151f7fd038f373e58fe0c5fbb84d1b42c
treea5eb56e22d0b6fe7469a8db18ab4d65fe5d793ba
parent81a85b12132c8ffe98f5ddbdc185481790aeaa1b
tracing: Ensure module defining synth event cannot be unloaded while tracing

commit 21581dd4e7ff6c07d0ab577e3c32b13a74b31522 upstream.

Currently, using synth_event_delete() will fail if the event is being
used (tracing in progress), but that is normally done in the module exit
function. At that stage, failing is problematic as returning a non-zero
status means the module will become locked (impossible to unload or
reload again).

Instead, ensure the module exit function does not get called in the
first place by increasing the module refcnt when the event is enabled.

Cc: stable@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fixes: 35ca5207c2d11 ("tracing: Add synthetic event command generation functions")
Link: https://lore.kernel.org/20250318180906.226841-1-douglas.raillard@arm.com
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
Acked-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>
kernel/trace/trace_events_synth.c