Linux Trace Kernel
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: Zhen Ni <zhen.ni@easystack.cn>, Nam Cao <namcao@linutronix.de>
Cc: linux-trace-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
		mhiramat@kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH] rv: Fix missing mutex unlock in rv_register_monitor()
Date: Thu, 04 Sep 2025 09:07:38 +0200	[thread overview]
Message-ID: <8fa89db22320220e1bc411ded115f0a40097f961.camel@redhat.com> (raw)
In-Reply-To: <20250903065112.1878330-1-zhen.ni@easystack.cn>

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 <zhen.ni@easystack.cn>

Good catch, thank you!

Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>

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)


  reply	other threads:[~2025-09-04  7:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  6:51 [PATCH] rv: Fix missing mutex unlock in rv_register_monitor() Zhen Ni
2025-09-04  7:07 ` Gabriele Monaco [this message]
2025-09-04  7:19   ` Nam Cao
2025-09-04  7:22     ` Gabriele Monaco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8fa89db22320220e1bc411ded115f0a40097f961.camel@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=namcao@linutronix.de \
    --cc=rostedt@goodmis.org \
    --cc=zhen.ni@easystack.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox