ftrace: Fix function tracing recursion self test
authorSteven Rostedt <srostedt@redhat.com>
Fri, 2 Nov 2012 21:01:20 +0000 (17:01 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 23 Jan 2013 04:37:58 +0000 (23:37 -0500)
The function tracing recursion self test should not crash
the machine if the resursion test fails. If it detects that
the function tracing is recursing when it should not be, then
bail, don't go into an infinite recursive loop.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace_selftest.c

index adb008a0136f8db51b11846d63d1102b35ca35ca..51c819c12c2916c8e93226c79d3fc464dc190ec3 100644 (file)
@@ -415,7 +415,8 @@ static void trace_selftest_test_recursion_func(unsigned long ip,
         * The ftrace infrastructure should provide the recursion
         * protection. If not, this will crash the kernel!
         */
-       trace_selftest_recursion_cnt++;
+       if (trace_selftest_recursion_cnt++ > 10)
+               return;
        DYN_FTRACE_TEST_NAME();
 }