summaryrefslogtreecommitdiffstats
path: root/net/lapb/lapb_timer.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2024-11-04 14:39:12 +0100
committerIngo Molnar <mingo@kernel.org>2025-03-01 19:38:42 +0100
commit003659fec9f6d8c04738cb74b5384398ae8a7e88 (patch)
treefc3a7217c62bae91b8a50eda27d9fcb32c28a316 /net/lapb/lapb_timer.c
parent2565e42539b120b81a68a58da961ce5d1e34eac8 (diff)
downloadlinux-003659fec9f6d8c04738cb74b5384398ae8a7e88.tar.gz
linux-003659fec9f6d8c04738cb74b5384398ae8a7e88.tar.bz2
linux-003659fec9f6d8c04738cb74b5384398ae8a7e88.zip
perf/core: Fix perf_pmu_register() vs. perf_init_event()
There is a fairly obvious race between perf_init_event() doing idr_find() and perf_pmu_register() doing idr_alloc() with an incompletely initialized PMU pointer. Avoid by doing idr_alloc() on a NULL pointer to register the id, and swizzling the real struct pmu pointer at the end using idr_replace(). Also making sure to not set struct pmu members after publishing the struct pmu, duh. [ introduce idr_cmpxchg() in order to better handle the idr_replace() error case -- if it were to return an unexpected pointer, it will already have replaced the value and there is no going back. ] Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20241104135517.858805880@infradead.org
Diffstat (limited to 'net/lapb/lapb_timer.c')
0 files changed, 0 insertions, 0 deletions