mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* fs/afs/server.c:375:5-24: WARNING: atomic_dec_and_test variation before object free at line 383.
@ 2025-05-20 16:52 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-05-20 16:52 UTC (permalink / raw)
  To: David Howells; +Cc: oe-kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   a5806cd506af5a7c19bcd596e4708b5c464bfd21
commit: 4882ba78574e2d8c579658f65f6784b0d139d173 afs: Fix afs_server ref accounting
date:   2 months ago
config: loongarch-randconfig-r061-20250520 (https://download.01.org/0day-ci/archive/20250521/202505210027.EOM219DU-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.2.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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505210027.EOM219DU-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> fs/afs/server.c:375:5-24: WARNING: atomic_dec_and_test variation before object free at line 383.
   fs/afs/server.c:357:5-24: WARNING: atomic_dec_and_test variation before object free at line 360.

vim +375 fs/afs/server.c

   365	
   366	/*
   367	 * Drop an active count on a server object.
   368	 */
   369	void afs_unuse_server(struct afs_net *net, struct afs_server *server,
   370			      enum afs_server_trace reason)
   371	{
   372		if (!server)
   373			return;
   374	
 > 375		if (atomic_dec_and_test(&server->active)) {
   376			if (!test_bit(AFS_SERVER_FL_EXPIRED, &server->flags) &&
   377			    READ_ONCE(server->cell->state) < AFS_CELL_FAILED) {
   378				time64_t unuse_time = ktime_get_real_seconds();
   379	
   380				server->unuse_time = unuse_time;
   381				afs_set_server_timer(server, afs_server_gc_delay);
   382			} else {
 > 383				schedule_work(&server->destroyer);
   384			}
   385		}
   386	
   387		afs_put_server(net, server, reason);
   388	}
   389	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread
* fs/afs/server.c:375:5-24: WARNING: atomic_dec_and_test variation before object free at line 383.
@ 2026-06-02  2:09 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-06-02  2:09 UTC (permalink / raw)
  To: David Howells; +Cc: oe-kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e43ffb69e0438cddd72aaa30898b4dc446f664f8
commit: 4882ba78574e2d8c579658f65f6784b0d139d173 afs: Fix afs_server ref accounting
date:   1 year, 3 months ago
config: hexagon-randconfig-r064-20260601 (https://download.01.org/0day-ci/archive/20260602/202606021010.6QMyYfim-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)

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
| Fixes: 4882ba78574e ("afs: Fix afs_server ref accounting")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606021010.6QMyYfim-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> fs/afs/server.c:375:5-24: WARNING: atomic_dec_and_test variation before object free at line 383.
   fs/afs/server.c:357:5-24: WARNING: atomic_dec_and_test variation before object free at line 360.

vim +375 fs/afs/server.c

   365	
   366	/*
   367	 * Drop an active count on a server object.
   368	 */
   369	void afs_unuse_server(struct afs_net *net, struct afs_server *server,
   370			      enum afs_server_trace reason)
   371	{
   372		if (!server)
   373			return;
   374	
 > 375		if (atomic_dec_and_test(&server->active)) {
   376			if (!test_bit(AFS_SERVER_FL_EXPIRED, &server->flags) &&
   377			    READ_ONCE(server->cell->state) < AFS_CELL_FAILED) {
   378				time64_t unuse_time = ktime_get_real_seconds();
   379	
   380				server->unuse_time = unuse_time;
   381				afs_set_server_timer(server, afs_server_gc_delay);
   382			} else {
 > 383				schedule_work(&server->destroyer);
   384			}
   385		}
   386	
   387		afs_put_server(net, server, reason);
   388	}
   389	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-02  2:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-20 16:52 fs/afs/server.c:375:5-24: WARNING: atomic_dec_and_test variation before object free at line 383 kernel test robot
2026-06-02  2:09 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®