io_uring/kbuf.c:271:5-24: WARNING: atomic_dec_and_test variation before object free at line 273.

From: kernel test robot
Date: Tue Oct 29 2024 - 18:43:43 EST


Hi Jens,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e42b1a9a2557aa94fee47f078633677198386a52
commit: 6b69c4ab4f685327d9e10caf0d84217ba23a8c4b io_uring/kbuf: protect io_buffer_list teardown with a reference
date: 7 months ago
config: arm-randconfig-r061-20241029 (https://download.01.org/0day-ci/archive/20241030/202410300609.JP8Dq6wz-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.1.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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410300609.JP8Dq6wz-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> io_uring/kbuf.c:271:5-24: WARNING: atomic_dec_and_test variation before object free at line 273.

vim +271 io_uring/kbuf.c

268
269 static void io_put_bl(struct io_ring_ctx *ctx, struct io_buffer_list *bl)
270 {
> 271 if (atomic_dec_and_test(&bl->refs)) {
272 __io_remove_buffers(ctx, bl, -1U);
> 273 kfree_rcu(bl, rcu);
274 }
275 }
276

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