Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] rv: Fix missing mutex unlock in rv_register_monitor()
@ 2025-09-03  6:51 Zhen Ni
  2025-09-04  7:07 ` Gabriele Monaco
  0 siblings, 1 reply; 4+ messages in thread
From: Zhen Ni @ 2025-09-03  6:51 UTC (permalink / raw)
  To: rostedt, mhiramat, mathieu.desnoyers; +Cc: linux-trace-kernel, Zhen Ni

If create_monitor_dir() fails, the function returns directly without
releasing rv_interface_lock. This leaves the mutex locked and causes
subsequent monitor registration attempts to deadlock.

Fix it by making the error path jump to out_unlock, ensuring that the
mutex is always released before returning.

Fixes: 24cbfe18d55a ("rv: Merge struct rv_monitor_def into struct rv_monitor")
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
 kernel/trace/rv/rv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
index 1482e91c39f4..e35565dd2dc5 100644
--- a/kernel/trace/rv/rv.c
+++ b/kernel/trace/rv/rv.c
@@ -805,7 +805,7 @@ int rv_register_monitor(struct rv_monitor *monitor, struct rv_monitor *parent)
 
 	retval = create_monitor_dir(monitor, parent);
 	if (retval)
-		return retval;
+		goto out_unlock;
 
 	/* keep children close to the parent for easier visualisation */
 	if (parent)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-04  7:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-03  6:51 [PATCH] rv: Fix missing mutex unlock in rv_register_monitor() Zhen Ni
2025-09-04  7:07 ` Gabriele Monaco
2025-09-04  7:19   ` Nam Cao
2025-09-04  7:22     ` Gabriele Monaco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox