aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_functions.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-06-29 10:05:45 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-06-29 10:05:45 -0400
commit0f17976568b3f72e676450af0c0db6f8752253d6 (patch)
tree6bd68d4113163f5205b7ee89a36b162e92b13d20 /kernel/trace/trace_functions.c
parent32c1431eea4881a6b17bd7c639315010aeefa452 (diff)
ftrace: Fix regression with module command in stack_trace_filter
When doing the following command: # echo ":mod:kvm_intel" > /sys/kernel/tracing/stack_trace_filter it triggered a crash. This happened with the clean up of probes. It required all callers to the regex function (doing ftrace filtering) to have ops->private be a pointer to a trace_array. But for the stack tracer, that is not the case. Allow for the ops->private to be NULL, and change the function command callbacks to handle the trace_array pointer being NULL as well. Fixes: d2afd57a4b96 ("tracing/ftrace: Allow instances to have their own function probes") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_functions.c')
-rw-r--r--kernel/trace/trace_functions.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index a3bddbfd0874..a0910c0cdf2e 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -654,6 +654,9 @@ ftrace_trace_onoff_callback(struct trace_array *tr, struct ftrace_hash *hash,
654{ 654{
655 struct ftrace_probe_ops *ops; 655 struct ftrace_probe_ops *ops;
656 656
657 if (!tr)
658 return -ENODEV;
659
657 /* we register both traceon and traceoff to this callback */ 660 /* we register both traceon and traceoff to this callback */
658 if (strcmp(cmd, "traceon") == 0) 661 if (strcmp(cmd, "traceon") == 0)
659 ops = param ? &traceon_count_probe_ops : &traceon_probe_ops; 662 ops = param ? &traceon_count_probe_ops : &traceon_probe_ops;
@@ -670,6 +673,9 @@ ftrace_stacktrace_callback(struct trace_array *tr, struct ftrace_hash *hash,
670{ 673{
671 struct ftrace_probe_ops *ops; 674 struct ftrace_probe_ops *ops;
672 675
676 if (!tr)
677 return -ENODEV;
678
673 ops = param ? &stacktrace_count_probe_ops : &stacktrace_probe_ops; 679 ops = param ? &stacktrace_count_probe_ops : &stacktrace_probe_ops;
674 680
675 return ftrace_trace_probe_callback(tr, ops, hash, glob, cmd, 681 return ftrace_trace_probe_callback(tr, ops, hash, glob, cmd,
@@ -682,6 +688,9 @@ ftrace_dump_callback(struct trace_array *tr, struct ftrace_hash *hash,
682{ 688{
683 struct ftrace_probe_ops *ops; 689 struct ftrace_probe_ops *ops;
684 690
691 if (!tr)
692 return -ENODEV;
693
685 ops = &dump_probe_ops; 694 ops = &dump_probe_ops;
686 695
687 /* Only dump once. */ 696 /* Only dump once. */
@@ -695,6 +704,9 @@ ftrace_cpudump_callback(struct trace_array *tr, struct ftrace_hash *hash,
695{ 704{
696 struct ftrace_probe_ops *ops; 705 struct ftrace_probe_ops *ops;
697 706
707 if (!tr)
708 return -ENODEV;
709
698 ops = &cpudump_probe_ops; 710 ops = &cpudump_probe_ops;
699 711
700 /* Only dump once. */ 712 /* Only dump once. */