[PATCH 0/2] tracing: Fix how the tracer options file ups the trace_array ref count

From: Steven Rostedt

Date: Wed Sep 02 2026 - 17:34:02 EST



Sashiko reported that the tracer option files pass a descriptor to
the file system operations that points to the trace_array it is apart
of as well as information on the tracer option. It uses the trace_array
to up its reference counter so that it can not be deleted when the option
is open. The issue is that this descriptor sent to the open call itself
can be removed by the removal of the instance the trace_array represents.
There's nothing protecting it for going away and dereferencing it after
it has been freed.

Another issue is that the tracer options are an array on an array for
each tracer in the trace_array descriptor. The first patch converts
that to a single array. This is need for the second patch.

The second patch changes the open function to search all the existing
trace_arrays under lock and compare their topts array with the topt
passed to the open function. If the topt is within the range of
a trace_array topts array then that trace_array is considered a match
and its reference is updated.

Steven Rostedt (2):
tracing: Use a single array to represent tracer options files
tracing: Take trace_array reference when opening a tracer options file

----
kernel/trace/trace.c | 81 +++++++++++++++++++++++++++++++++-------------------
kernel/trace/trace.h | 21 ++++++--------
2 files changed, 60 insertions(+), 42 deletions(-)