]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tracing: tprobe-events: Fix leakage of module refcount
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Thu, 13 Mar 2025 01:00:10 +0000 (10:00 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Mar 2025 21:03:28 +0000 (22:03 +0100)
commit71c9cf87776eaa556fc0a0a060df94200e1f521c
tree24b2ed2e7eed872dae9d1c1fcfdbc1870550484b
parenta3ff812d68f64c48c082e37d46a8098769f77504
tracing: tprobe-events: Fix leakage of module refcount

commit ac91052f0ae5be9e46211ba92cc31c0e3b0a933a upstream.

When enabling the tracepoint at loading module, the target module
refcount is incremented by find_tracepoint_in_module(). But it is
unnecessary because the module is not unloaded while processing
module loading callbacks.
Moreover, the refcount is not decremented in that function.
To be clear the module refcount handling, move the try_module_get()
callsite to trace_fprobe_create_internal(), where it is actually
required.

Link: https://lore.kernel.org/all/174182761071.83274.18334217580449925882.stgit@devnote2/
Fixes: 57a7e6de9e30 ("tracing/fprobe: Support raw tracepoints on future loaded modules")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/trace_fprobe.c