mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
perf tools: NULL bitmap pointers after bitmap_free()
Two call sites free bitmaps without NULLing the pointer, risking double-free if the structure is reused or cleanup is called twice: - mmap__munmap(): map->affinity_mask.bits - record__mmap_cpu_mask_free(): mask->bits Set each pointer to NULL after bitmap_free(). Fixes:8384a2600c("perf record: Adapt affinity to machines with #CPUs > 1K") Fixes:f466e5ed6c("perf record: Extend --threads command line option") Reported-by: sashiko-bot <sashiko-bot@kernel.org> Reviewed-by: Ian Rogers <irogers@google.com> Cc: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
5484b43a0e
commit
a9e900bc5c
|
|
@ -3084,6 +3084,7 @@ static int record__mmap_cpu_mask_alloc(struct mmap_cpu_mask *mask, int nr_bits)
|
|||
static void record__mmap_cpu_mask_free(struct mmap_cpu_mask *mask)
|
||||
{
|
||||
bitmap_free(mask->bits);
|
||||
mask->bits = NULL;
|
||||
mask->nbits = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,6 +238,8 @@ static void perf_mmap__aio_munmap(struct mmap *map __maybe_unused)
|
|||
void mmap__munmap(struct mmap *map)
|
||||
{
|
||||
bitmap_free(map->affinity_mask.bits);
|
||||
map->affinity_mask.bits = NULL;
|
||||
map->affinity_mask.nbits = 0;
|
||||
|
||||
zstd_fini(&map->zstd_data);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user