Skip to content

Commit a6a1132

Browse files
guoweikangSasha Levin
authored andcommitted
ftrace: Fix regression with module command in stack_trace_filter
commit 45af52e upstream. When executing the following command: # echo "write*:mod:ext3" > /sys/kernel/tracing/stack_trace_filter The current mod command causes a null pointer dereference. While commit 0f17976 ("ftrace: Fix regression with module command in stack_trace_filter") has addressed part of the issue, it left a corner case unhandled, which still results in a kernel crash. Cc: [email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: 04ec7bb ("tracing: Have the trace_array hold the list of registered func probes"); Signed-off-by: guoweikang <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0eab1c5 commit a6a1132

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/trace/ftrace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4437,6 +4437,9 @@ ftrace_mod_callback(struct trace_array *tr, struct ftrace_hash *hash,
44374437
char *func;
44384438
int ret;
44394439

4440+
if (!tr)
4441+
return -ENODEV;
4442+
44404443
/* match_records() modifies func, and we need the original */
44414444
func = kstrdup(func_orig, GFP_KERNEL);
44424445
if (!func)

0 commit comments

Comments
 (0)