Skip to content

Commit 50cc9d4

Browse files
committed
rv: Fully convert enabled_monitors to use list_head as iterator
JIRA: https://issues.redhat.com/browse/RHEL-114754 commit 103541e Author: Nam Cao <namcao@linutronix.de> Date: Thu Oct 2 08:22:35 2025 +0000 rv: Fully convert enabled_monitors to use list_head as iterator 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: de090d1 ("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 Reviewed-by: Gabriele Monaco <gmonaco@redhat.com> Link: https://lore.kernel.org/r/20251002082235.973099-1-namcao@linutronix.de Signed-off-by: Gabriele Monaco <gmonaco@redhat.com> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
1 parent aa09b40 commit 50cc9d4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kernel/trace/rv/rv.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,31 +501,31 @@ static void *enabled_monitors_next(struct seq_file *m, void *p, loff_t *pos)
501501

502502
list_for_each_entry_continue(mon, &rv_monitors_list, list) {
503503
if (mon->enabled)
504-
return mon;
504+
return &mon->list;
505505
}
506506

507507
return NULL;
508508
}
509509

510510
static void *enabled_monitors_start(struct seq_file *m, loff_t *pos)
511511
{
512-
struct rv_monitor *mon;
512+
struct list_head *head;
513513
loff_t l;
514514

515515
mutex_lock(&rv_interface_lock);
516516

517517
if (list_empty(&rv_monitors_list))
518518
return NULL;
519519

520-
mon = list_entry(&rv_monitors_list, struct rv_monitor, list);
520+
head = &rv_monitors_list;
521521

522522
for (l = 0; l <= *pos; ) {
523-
mon = enabled_monitors_next(m, mon, &l);
524-
if (!mon)
523+
head = enabled_monitors_next(m, head, &l);
524+
if (!head)
525525
break;
526526
}
527527

528-
return mon;
528+
return head;
529529
}
530530

531531
/*

0 commit comments

Comments
 (0)