Skip to content

Commit 9640388

Browse files
Steven Rostedtrostedt
authored andcommitted
ftrace: Fix function tracing recursion self test
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>
1 parent 6350379 commit 9640388

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/trace/trace_selftest.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ static void trace_selftest_test_recursion_func(unsigned long ip,
415415
* The ftrace infrastructure should provide the recursion
416416
* protection. If not, this will crash the kernel!
417417
*/
418-
trace_selftest_recursion_cnt++;
418+
if (trace_selftest_recursion_cnt++ > 10)
419+
return;
419420
DYN_FTRACE_TEST_NAME();
420421
}
421422

0 commit comments

Comments
 (0)