ACK: [SRU][Q][PATCH 1/1] rv: Fully convert enabled_monitors to use list_head as iterator
Stefan Bader
stefan.bader at canonical.com
Wed Nov 12 12:35:28 UTC 2025
On 12/11/2025 12:59, Edoardo Canepa wrote:
> From: Nam Cao <namcao at linutronix.de>
>
> BugLink: https://bugs.launchpad.net/bugs/2131136
>
> 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.
>
> Fixes: de090d1ccae1 ("rv: Fix wrong type cast in enabled_monitors_next()")
> Reported-by: Nathan Chancellor <nathan at kernel.org>
> Closes: https://lore.kernel.org/linux-trace-kernel/20250923002004.GA2836051@ax162/
> Signed-off-by: Nam Cao <namcao at linutronix.de>
> Cc: stable at vger.kernel.org
> Reviewed-by: Gabriele Monaco <gmonaco at redhat.com>
> Link: https://lore.kernel.org/r/20251002082235.973099-1-namcao@linutronix.de
> Signed-off-by: Gabriele Monaco <gmonaco at redhat.com>
> (cherry picked from commit 103541e6a5854b08a25e4caa61e990af1009a52e)
> Signed-off-by: Edoardo Canepa <edoardo.canepa at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>> ---
> 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;
> }
>
> /*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xE8675DEECBEECEA3.asc
Type: application/pgp-keys
Size: 48643 bytes
Desc: OpenPGP public key
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20251112/edec0706/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20251112/edec0706/attachment-0001.sig>
More information about the kernel-team
mailing list