]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf tools: NULL bitmap pointers after bitmap_free()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 7 Jun 2026 00:31:51 +0000 (21:31 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 10 Jun 2026 16:13:32 +0000 (13:13 -0300)
commita9e900bc5c5914aca750afafa459363e575d3046
tree28d24781ab1ec06b3cafe12f0687515816f8b790
parent5484b43a0ec8231c36fba6ead654cb72dbba8b8f
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: 8384a2600c7ddfc8 ("perf record: Adapt affinity to machines with #CPUs > 1K")
Fixes: f466e5ed6c356d1d ("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>
tools/perf/builtin-record.c
tools/perf/util/mmap.c