On Wed, 2025-09-03 at 14:51 +0800, Zhen Ni wrote:
> 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 <[email protected]>
Good catch, thank you!
Reviewed-by: Gabriele Monaco <[email protected]>
I would also add a:
Fixes: 24cbfe18d55a ("rv: Merge struct rv_monitor_def into struct rv_monitor")
(Adding Nam to the loop, as author of that patch)
Thanks,
Gabriele
> ---
> 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)