Re: [PATCH] riscv: stacktrace: Fix NULL task pointer in^J ftrace_graph_ret_addr()
From: Paul Walmsley
Date: Mon Nov 30 2026 - 21:09:50 EST
On Wed, 8 Jul 2026, zhang.anmeng@xxxxxxxxxx wrote:
> When dump_backtrace() is called with a NULL task argument, and the
> call stack contains functions that are being traced,
> walk_stackframe() eventually calls ftrace_graph_ret_addr() with the
> NULL task pointer, which results in a NULL pointer dereference when
> accessing task->curr_ret_stack.
>
> Fix this by assigning the task pointer to the current task in
> walk_stackframe() when it is NULL, keeping the behavior consistent
> with other architectures.
>
> Fixes: ecbf894165a2 ("riscv: Fix ftrace_graph_ret_addr() to use the correct task pointer")
> Reviewed-by: Shengming Hu <hu.shengming@xxxxxxxxxx>
> Reviewed-by: Rui Gao <gao.rui@xxxxxxxxxx>
> Reviewed-by: Luo Haiyang <luo.haiyang@xxxxxxxxxx>
> Reviewed-by: Run Zhang <zhang.run@xxxxxxxxxx>
> Signed-off-by: Anmeng Zhang <zhang.anmeng@xxxxxxxxxx>
Thanks, queued for v7.4-rc with a cc to stable.
- Paul