[PATCH -next 0/2] ftrace: Some minor fixes for set_ftrace_{notrace,filter} file handling

From: Tengda Wu
Date: Tue Aug 12 2025 - 22:31:20 EST


Hello,

This patch series addresses two issues in the ftrace subsystem related
to the handling of set_ftrace_{notrace,filter} files.

Patch 1 removes an incorrect free_ftrace_hash call in ftrace_regex_open()
that could lead to use-after-free when seq_open fails.

Patch 2 fixes a potential use-after-free scenario that can occur during
concurrent read/write operations on the set_ftrace_{notrace,filter} files.

Both issues were reproducible. This patches aims to fix them.

Best regards,
Tengda

Tengda Wu (2):
ftrace: Remove unnecessary free_ftrace_hash in ftrace_regex_open
ftrace: Fix potential use-after-free for set_ftrace_{notrace,filter}
files

kernel/trace/ftrace.c | 28 ++++++++++++++++++++++++----
kernel/trace/trace.h | 2 ++
2 files changed, 26 insertions(+), 4 deletions(-)

--
2.34.1