> On Jul 19, 2022, at 11:28 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > >> /** >> * register_ftrace_function - register a function for profiling >> * @ops: ops structure that holds the function for profiling. >> @@ -8016,17 +8192,29 @@ int ftrace_is_dead(void) >> * recursive loop. >> */ >> int register_ftrace_function(struct ftrace_ops *ops) >> + __releases(&direct_mutex) >> { >> + bool direct_mutex_locked = false; >> int ret; >> >> ftrace_ops_init(ops); >> > > I agree with Petr. > > Just grab the direct_mutex_lock here. > > mutex_lock(&direct_mutex); Actually, we cannot blindly lock direct_mutex here, as register_ftrace_direct() already locks it before calling register_ftrace_function(). We still need the if (IPMODIFY) check. Thanks, Song > >> + ret = prepare_direct_functions_for_ipmodify(ops); >> + if (ret < 0) >> + return ret; >