There's list corruption on cgrp_cpuctx_list. This happens on the following path: perf_cgroup_switch: list_for_each_entry(cgrp_cpuctx_list) cpu_ctx_sched_in ctx_sched_in ctx_pinned_sched_in merge_sched_in perf_cgroup_event_disable: remove the event from the list Use list_for_each_entry_safe() to allow removing an entry during iteration.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -839,7 +839,7 @@ static DEFINE_PER_CPU(struct list_head, cgrp_cpuctx_list); · 838 unmodified lines | ||
| 839 | 839 | */ |
| 840 | 840 | static void perf_cgroup_switch(struct task_struct *task, int mode) |
| 841 | 841 | { |
| 842 | − struct perf_cpu_context *cpuctx; | |
| 842 | + struct perf_cpu_context *cpuctx, *tmp; | |
| 843 | 843 | struct list_head *list; |
| 844 | 844 | unsigned long flags; |
| 845 | 845 | |
| @@ -850,7 +850,7 @@ static void perf_cgroup_switch(struct task_struct *task, int mode) · 4 unmodified lines | ||
| 850 | 850 | local_irq_save(flags); |
| 851 | 851 | |
| 852 | 852 | list = this_cpu_ptr(&cgrp_cpuctx_list); |
| 853 | − list_for_each_entry(cpuctx, list, cgrp_cpuctx_entry) { | |
| 853 | + list_for_each_entry_safe(cpuctx, tmp, list, cgrp_cpuctx_entry) { | |
| 854 | 854 | WARN_ON_ONCE(cpuctx->ctx.nr_cgroups == 0); |
| 855 | 855 | |
| 856 | 856 | perf_ctx_lock(cpuctx, cpuctx->task_ctx); |