fgraph: Fix missing unlock in register_ftrace_graph()
authorLi Huafei <lihuafei1@huawei.com>
Thu, 24 Oct 2024 15:59:17 +0000 (23:59 +0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 25 Oct 2024 02:26:06 +0000 (22:26 -0400)
commitbd3734db86e01e20dd239a40b419059a0ce9c901
treeb24f7bb0925bc56f8c0b40b005ee3f8d5aa276f0
parentfae4078c289a2f24229c0de652249948b1cd6bdb
fgraph: Fix missing unlock in register_ftrace_graph()

Use guard(mutex)() to acquire and automatically release ftrace_lock,
fixing the issue of not unlocking when calling cpuhp_setup_state()
fails.

Fixes smatch warning:

kernel/trace/fgraph.c:1317 register_ftrace_graph() warn: inconsistent returns '&ftrace_lock'.

Link: https://lore.kernel.org/20241024155917.1019580-1-lihuafei1@huawei.com
Fixes: 2c02f7375e65 ("fgraph: Use CPU hotplug mechanism to initialize idle shadow stacks")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410220121.wxg0olfd-lkp@intel.com/
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/fgraph.c