Thread (5 messages) 5 messages, 2 authors, 2024-10-24

[PATCH] fgraph: Fix missing unlock in register_ftrace_graph()

From: Li Huafei <hidden>
Date: 2024-10-23 09:04:00
Also in: lkml, oe-kbuild
Subsystem: function hooks (ftrace), the rest, tracing · Maintainers: Steven Rostedt, Masami Hiramatsu, Linus Torvalds

Instead of returning an error, goto the mutex unlock at the end of the
function.

Fixes smatch warning:

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

Fixes: 2c02f7375e65 ("fgraph: Use CPU hotplug mechanism to initialize idle shadow stacks")
Reported-by: kernel test robot <redacted>
Reported-by: Dan Carpenter <redacted>
Closes: https://lore.kernel.org/r/202410220121.wxg0olfd-lkp@intel.com/ (local)
Signed-off-by: Li Huafei <redacted>
---
 kernel/trace/fgraph.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index 41e7a15dcb50..98fa7b2a4903 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -1259,7 +1259,7 @@ int register_ftrace_graph(struct fgraph_ops *gops)
 					fgraph_cpu_init, NULL);
 		if (ret < 0) {
 			pr_warn("fgraph: Error to init cpu hotplug support\n");
-			return ret;
+			goto out;
 		}
 		fgraph_initialized = true;
 		ret = 0;
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help