Skip to contentSkip to conversation

mm/mmap_lock.c:572:14-33: WARNING: atomic_dec_and_test variation before object free at line 574.

PATCH kernel test robot 2 participants 2 messages Nov 25 Memory management

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head:   c8117bff684306f5c1f959d055cc2b24dd67b1eb
commit: 549e0b6c9835de4cc4e8e4a56459ef09febfc2f7 [33/408] mm/vma: drop mm asynchronously in vma_start_read()
config: sh-randconfig-r2100-20261125 (https://download.01.org/0day-ci/archive/20261125/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 12.5.0

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 >>)

>> mm/mmap_lock.c:572:14-33: WARNING: atomic_dec_and_test variation before object free at line 574.

vim +572 mm/mmap_lock.c

569
570 void mmdrop_async(struct mm_struct *mm)
571 {

 > 572		if (unlikely(atomic_dec_and_test(&mm->mm_count))) {
   573			INIT_WORK(&mm->async_put_work, mmdrop_async_fn);
 > 574			schedule_work(&mm->async_put_work);

575 }
576 }
577

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 6 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head:   c8117bff684306f5c1f959d055cc2b24dd67b1eb
commit: 549e0b6c9835de4cc4e8e4a56459ef09febfc2f7 [33/408] mm/vma: drop mm asynchronously in vma_start_read()
config: sh-randconfig-r2100-20261125 (https://download.01.org/0day-ci/archive/20261125/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 12.5.0
Quoted 7 lines

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 >>)

Quoted 1 line
Quoted 1 line

mm/mmap_lock.c:572:14-33: WARNING: atomic_dec_and_test variation before object free at line 574.

So AFAIU this is a suggestion to use refcount_t instead of atomic_t in new code, but this is a move of an existing code and intended to be a minimal fix. So we can ignore.

(this is intended for saving Lorenzo a reply, let's see if he can resist :)

Quoted 12 lines

vim +572 mm/mmap_lock.c

   569	
   570	void mmdrop_async(struct mm_struct *mm)
   571	{
Quoted 1 line

572 if (unlikely(atomic_dec_and_test(&mm->mm_count))) {

573 INIT_WORK(&mm->async_put_work, mmdrop_async_fn);

Quoted 1 line

574 schedule_work(&mm->async_put_work);

575 }
576 }
577