]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
rv: Fix missing mutex unlock in rv_register_monitor()
authorZhen Ni <zhen.ni@easystack.cn>
Wed, 3 Sep 2025 06:51:12 +0000 (14:51 +0800)
committerGabriele Monaco <gmonaco@redhat.com>
Mon, 15 Sep 2025 06:36:35 +0000 (08:36 +0200)
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>
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20250903065112.1878330-1-zhen.ni@easystack.cn
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
kernel/trace/rv/rv.c

index b341445b8fbdf1cc775132f731e37588f0fe1d15..48338520376f90d5a85b6fbef7ee107ab2852732 100644 (file)
@@ -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)