drivers/net/ethernet/broadcom/bnxt/bnxt.c:5333:6-25: WARNING: atomic_dec_and_test variation before object free at line 5336.

From: kernel test robot
Date: Tue Oct 22 2024 - 08:18:47 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c2ee9f594da826bea183ed14f2cc029c719bf4da
commit: 1f6e77cb9b328f2ec145e73be97cab6fec838678 bnxt_en: Add bnxt_l2_filter hash table.
date: 10 months ago
config: arc-randconfig-r052-20241022 (https://download.01.org/0day-ci/archive/20241022/202410222004.wyOjgwYT-lkp@xxxxxxxxx/config)
compiler: arc-elf-gcc (GCC) 13.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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410222004.wyOjgwYT-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:5333:6-25: WARNING: atomic_dec_and_test variation before object free at line 5336.

vim +5333 drivers/net/ethernet/broadcom/bnxt/bnxt.c

5330
5331 void bnxt_del_l2_filter(struct bnxt *bp, struct bnxt_l2_filter *fltr)
5332 {
> 5333 if (!atomic_dec_and_test(&fltr->refcnt))
5334 return;
5335 spin_lock_bh(&bp->ntp_fltr_lock);
> 5336 hlist_del_rcu(&fltr->base.hash);
5337 if (fltr->base.flags) {
5338 clear_bit(fltr->base.sw_id, bp->ntp_fltr_bmap);
5339 bp->ntp_fltr_count--;
5340 }
5341 spin_unlock_bh(&bp->ntp_fltr_lock);
5342 kfree_rcu(fltr, base.rcu);
5343 }
5344

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