mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-31 11:47:42 +08:00
fgraph: Use guard(mutex)(&ftrace_lock) for unregister_ftrace_graph()
The ftrace_lock is held throughout unregister_ftrace_graph(), use a guard to simplify the error paths. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/20241028071307.770550792@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
committed by
Steven Rostedt (Google)
parent
434098485b
commit
6348a3fa72
@@ -1381,17 +1381,17 @@ void unregister_ftrace_graph(struct fgraph_ops *gops)
|
||||
{
|
||||
int command = 0;
|
||||
|
||||
mutex_lock(&ftrace_lock);
|
||||
guard(mutex)(&ftrace_lock);
|
||||
|
||||
if (unlikely(!ftrace_graph_active))
|
||||
goto out;
|
||||
return;
|
||||
|
||||
if (unlikely(gops->idx < 0 || gops->idx >= FGRAPH_ARRAY_SIZE ||
|
||||
fgraph_array[gops->idx] != gops))
|
||||
goto out;
|
||||
return;
|
||||
|
||||
if (fgraph_lru_release_index(gops->idx) < 0)
|
||||
goto out;
|
||||
return;
|
||||
|
||||
fgraph_array[gops->idx] = &fgraph_stub;
|
||||
|
||||
@@ -1413,7 +1413,5 @@ void unregister_ftrace_graph(struct fgraph_ops *gops)
|
||||
unregister_pm_notifier(&ftrace_suspend_notifier);
|
||||
unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
|
||||
}
|
||||
out:
|
||||
gops->saved_func = NULL;
|
||||
mutex_unlock(&ftrace_lock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user