Skip to contentSkip to conversation

kernel/bpf/arena.c:245:6-25: WARNING: atomic_dec_and_test variation before object free at line 249.

DISCUSSION kernel test robot 1 participant 1 message Dec 29, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   059dd502b263d8a4e2a84809cf1068d6a3905e6f
commit: b90d77e5fd784ada62ddd714d15ee2400c28e1cf bpf: Fix remap of arena.
date:   6 months ago
config: x86_64-randconfig-104-20241229 (https://download.01.org/0day-ci/archive/20241229/[email protected]/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

cocci warnings: (new ones prefixed by >>)

>> kernel/bpf/arena.c:245:6-25: WARNING: atomic_dec_and_test variation before object free at line 249.

vim +245 kernel/bpf/arena.c

238
239 static void arena_vm_close(struct vm_area_struct *vma)
240 {
241 struct bpf_map *map = vma->vm_file->private_data;
242 struct bpf_arena *arena = container_of(map, struct bpf_arena, map);
243 struct vma_list *vml = vma->vm_private_data;
244

 > 245		if (!atomic_dec_and_test(&vml->mmap_count))
   246			return;
   247		guard(mutex)(&arena->lock);
   248		/* update link list under lock */
 > 249		list_del(&vml->head);

250 vma->vm_private_data = NULL;
251 kfree(vml);
252 }
253

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki