From: Steven Rostedt (VMware) Date: Fri, 1 Sep 2017 16:04:09 +0000 (-0400) Subject: ftrace: Fix selftest goto location on error X-Git-Tag: v4.13.4~28 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c0b8a375da604fa4a8a126dbabad0bc7f5c53939;p=users%2Fdwmw2%2Flinux.git ftrace: Fix selftest goto location on error commit 46320a6acc4fb58f04bcf78c4c942cc43b20f986 upstream. In the second iteration of trace_selftest_ops(), the error goto label is wrong in the case where trace_selftest_test_global_cnt is off. In the case of error, it leaks the dynamic ops that was allocated. Fixes: 95950c2e ("ftrace: Add self-tests for multiple function trace users") Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index cb917cebae291..b17ec642793bc 100644 --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c @@ -273,7 +273,7 @@ static int trace_selftest_ops(struct trace_array *tr, int cnt) goto out_free; if (cnt > 1) { if (trace_selftest_test_global_cnt == 0) - goto out; + goto out_free; } if (trace_selftest_test_dyn_cnt == 0) goto out_free;