On Sat, Feb 28, 2026 at 03:39:21PM -0500, Steven Rostedt wrote:
> On Fri, 27 Feb 2026 22:24:37 +0100
> Jiri Olsa <[email protected]> wrote:
> 
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 827fb9a0bf0d..e333749a5896 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -6404,7 +6404,9 @@ int update_ftrace_direct_add(struct ftrace_ops *ops, 
> > struct ftrace_hash *hash)
> >                     new_filter_hash = old_filter_hash;
> >             }
> >     } else {
> 
> As this looks to fix the issue, just add:
> 
>               guard(mutex)(&ftrace_lock);
> 
> > +           mutex_lock(&ftrace_lock);
> >             err = ftrace_update_ops(ops, new_filter_hash, EMPTY_HASH);
> > +           mutex_unlock(&ftrace_lock);
> >             /*
> >              * new_filter_hash is dup-ed, so we need to release it anyway,
> >              * old_filter_hash either stays on error or is already released
> > @@ -6530,7 +6532,9 @@ int update_ftrace_direct_del(struct ftrace_ops *ops, 
> > struct ftrace_hash *hash)
> >                     ops->func_hash->filter_hash = NULL;
> >             }
> >     } else {
> 
> And here too.
> 
> As there's nothing after the comment and before the end of the block.

ok, will do.. the original changes:

  05dc5e9c1fe1 ("ftrace: Add update_ftrace_direct_add function")
  8d2c1233f371 ("ftrace: Add update_ftrace_direct_del function")

went through bpf tree, so I'll send the fix the same way,
please let me know otherwise

thanks,
jirka


> 
> -- Steve
> 
> > +           mutex_lock(&ftrace_lock);
> >             err = ftrace_update_ops(ops, new_filter_hash, EMPTY_HASH);
> > +           mutex_unlock(&ftrace_lock);
> >             /*
> >              * new_filter_hash is dup-ed, so we need to release it anyway,
> >              * old_filter_hash either stays on error or is already released
> 
> 
> 
> -- Steve

Reply via email to