diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-12-10 23:58:01 -0500 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-02-11 17:54:24 +0000 |
commit | 749a8d78affba1ea2b7be8d8d05c4604c2034485 (patch) | |
tree | 42a464975fe1a36e78f5a4bccf7310ef5e797659 | |
parent | dc7c8020cc300cb94306be4e5bc0aeec85eefaec (diff) |
tracing: Fix memory leak of instance function hash filters
commit 2840f84f74035e5a535959d5f17269c69fa6edc5 upstream.
The following commands will cause a memory leak:
# cd /sys/kernel/tracing
# mkdir instances/foo
# echo schedule > instance/foo/set_ftrace_filter
# rmdir instances/foo
The reason is that the hashes that hold the filters to set_ftrace_filter and
set_ftrace_notrace are not freed if they contain any data on the instance
and the instance is removed.
Found by kmemleak detector.
Fixes: 591dffdade9f ("ftrace: Allow for function tracing instance to filter functions")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | kernel/trace/ftrace.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 3b1f547a80e1..8ee705e1d472 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -4127,6 +4127,7 @@ void ftrace_destroy_filter_files(struct ftrace_ops *ops) if (ops->flags & FTRACE_OPS_FL_ENABLED) ftrace_shutdown(ops, 0); ops->flags |= FTRACE_OPS_FL_DELETED; + ftrace_free_filter(ops); mutex_unlock(&ftrace_lock); } |