ftrace: Test for NULL iter->tr in regex for stack_trace_filter changes
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 5 Jul 2017 13:45:43 +0000 (09:45 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 5 Jul 2017 13:52:18 +0000 (09:52 -0400)
As writing into stack_trace_filter, the iter-tr is not set and is NULL.
Check if it is NULL before dereferencing it in ftrace_regex_release().

Fixes: 8c08f0d5c6fb ("ftrace: Have cached module filters be an active filter")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ftrace.c

index f8c18f15b1906b7e381407e636698bf6d55b0d55..2953d558bbee7055ee919e4d4b116378ffe4a040 100644 (file)
@@ -5043,7 +5043,7 @@ int ftrace_regex_release(struct inode *inode, struct file *file)
 
                if (filter_hash) {
                        orig_hash = &iter->ops->func_hash->filter_hash;
-                       if (!list_empty(&iter->tr->mod_trace))
+                       if (iter->tr && !list_empty(&iter->tr->mod_trace))
                                iter->hash->flags |= FTRACE_HASH_FL_MOD;
                } else
                        orig_hash = &iter->ops->func_hash->notrace_hash;