Skip to content

Commit 0c66777

Browse files
committed
ftrace: Have ftrace_free_filter() WARN and exit if ops is active
The ftrace_free_filter() is used to reset the ops filters. But it must be done if the ops is not currently active (tracing). If it is, it will mess up the ftrace accounting of what functions are attached and what is not. WARN and exit the ftrace_free_filter() if the ops is active when it is called. Currently, it doesn't seem if anything does this, but it may in the future. Link: https://lore.kernel.org/all/[email protected]/ Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 97d6a9c commit 0c66777

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/ftrace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,8 @@ static void free_ftrace_hash_rcu(struct ftrace_hash *hash)
12961296
void ftrace_free_filter(struct ftrace_ops *ops)
12971297
{
12981298
ftrace_ops_init(ops);
1299+
if (WARN_ON(ops->flags & FTRACE_OPS_FL_ENABLED))
1300+
return;
12991301
free_ftrace_hash(ops->func_hash->filter_hash);
13001302
free_ftrace_hash(ops->func_hash->notrace_hash);
13011303
}

0 commit comments

Comments
 (0)