diff options
author | Frederic Weisbecker <frederic@kernel.org> | 2025-04-24 18:11:25 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2025-05-08 21:50:18 +0200 |
commit | 22d38babb3adcb1227ecfb91d9423008a46548fe (patch) | |
tree | ae88b4dcb54d5e841b537b7eea797523d9ce3cfa /scripts/lib/kdoc/kdoc_files.py | |
parent | 3e830f657f69ab6a4822d72ec2f364c6d51beef8 (diff) |
perf: Fix failing inherit_event() doing extra refcount decrement on parent
When inherit_event() fails after the child allocation but before the
parent refcount has been incremented, calling put_event() wrongly
decrements the reference to the parent, risking to free it too early.
Also pmu_get_event() can't be holding a reference to the child
concurrently at this point since it is under pmus_srcu critical section.
Fix it with restoring the deleted free_event() function and call it on
the failing child in order to free it directly under the verified
assumption that its refcount is only 1. The refcount to the parent is
then voluntarily omitted.
Fixes: da916e96e2de ("perf: Make perf_pmu_unregister() useable")
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250424161128.29176-2-frederic@kernel.org
Diffstat (limited to 'scripts/lib/kdoc/kdoc_files.py')
0 files changed, 0 insertions, 0 deletions