perf: Fix dangling cgroup pointer in cpuctx
authorYeoreum Yun <yeoreum.yun@arm.com>
Mon, 2 Jun 2025 18:40:49 +0000 (19:40 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 5 Jun 2025 12:37:52 +0000 (14:37 +0200)
commit3b7a34aebbdf2a4b7295205bf0c654294283ec82
tree6fb3b6fa4be3ece8e139f7eb91e3a294001fa87f
parent61988e36dc5457cdff7ae7927e8d9ad1419ee998
perf: Fix dangling cgroup pointer in cpuctx

Commit a3c3c6667("perf/core: Fix child_total_time_enabled accounting
bug at task exit") moves the event->state update to before
list_del_event(). This makes the event->state test in list_del_event()
always false; never calling perf_cgroup_event_disable().

As a result, cpuctx->cgrp won't be cleared properly; causing havoc.

Fixes: a3c3c6667("perf/core: Fix child_total_time_enabled accounting bug at task exit")
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: David Wang <00107082@163.com>
Link: https://lore.kernel.org/all/aD2TspKH%2F7yvfYoO@e129823.arm.com/
kernel/events/core.c