linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: Nam Cao <namcao@linutronix.de>, Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-trace-kernel@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	 stable@vger.kernel.org
Subject: Re: [PATCH 1/2] rv: Fully convert enabled_monitors to use list_head as iterator
Date: Thu, 02 Oct 2025 13:42:24 +0200	[thread overview]
Message-ID: <77c1e6213e1c250ad8bf57849d8c90dfd2f105d1.camel@redhat.com> (raw)
In-Reply-To: <20251002082235.973099-1-namcao@linutronix.de>



On Thu, 2025-10-02 at 08:22 +0000, Nam Cao wrote:
> The callbacks in enabled_monitors_seq_ops are inconsistent. Some treat the
> iterator as struct rv_monitor *, while others treat the iterator as struct
> list_head *.
> 
> This causes a wrong type cast and crashes the system as reported by Nathan.
> 
> Convert everything to use struct list_head * as iterator. This also makes
> enabled_monitors consistent with available_monitors.
> 

Looks good to me and passes my tests.

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

Thanks,
Gabriele

> Fixes: de090d1ccae1 ("rv: Fix wrong type cast in enabled_monitors_next()")
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Closes:
> https://lore.kernel.org/linux-trace-kernel/20250923002004.GA2836051@ax162/
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: <stable@vger.kernel.org>
> ---
>  kernel/trace/rv/rv.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
> index 48338520376f..43e9ea473cda 100644
> --- a/kernel/trace/rv/rv.c
> +++ b/kernel/trace/rv/rv.c
> @@ -501,7 +501,7 @@ static void *enabled_monitors_next(struct seq_file *m,
> void *p, loff_t *pos)
>  
>  	list_for_each_entry_continue(mon, &rv_monitors_list, list) {
>  		if (mon->enabled)
> -			return mon;
> +			return &mon->list;
>  	}
>  
>  	return NULL;
> @@ -509,7 +509,7 @@ static void *enabled_monitors_next(struct seq_file *m,
> void *p, loff_t *pos)
>  
>  static void *enabled_monitors_start(struct seq_file *m, loff_t *pos)
>  {
> -	struct rv_monitor *mon;
> +	struct list_head *head;
>  	loff_t l;
>  
>  	mutex_lock(&rv_interface_lock);
> @@ -517,15 +517,15 @@ static void *enabled_monitors_start(struct seq_file *m,
> loff_t *pos)
>  	if (list_empty(&rv_monitors_list))
>  		return NULL;
>  
> -	mon = list_entry(&rv_monitors_list, struct rv_monitor, list);
> +	head = &rv_monitors_list;
>  
>  	for (l = 0; l <= *pos; ) {
> -		mon = enabled_monitors_next(m, mon, &l);
> -		if (!mon)
> +		head = enabled_monitors_next(m, head, &l);
> +		if (!head)
>  			break;
>  	}
>  
> -	return mon;
> +	return head;
>  }
>  
>  /*


      reply	other threads:[~2025-10-02 11:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02  8:22 [PATCH 1/2] rv: Fully convert enabled_monitors to use list_head as iterator Nam Cao
2025-10-02 11:42 ` Gabriele Monaco [this message]

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=77c1e6213e1c250ad8bf57849d8c90dfd2f105d1.camel@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=namcao@linutronix.de \
    --cc=nathan@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).