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 Dec 10 2024 - 22:38:30 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7cb1b466315004af98f6ba6c2546bb713ca3c237
commit: 1f6e77cb9b328f2ec145e73be97cab6fec838678 bnxt_en: Add bnxt_l2_filter hash table.
date: 11 months ago
config: sparc64-randconfig-r061-20241210 (https://download.01.org/0day-ci/archive/20241211/202412111151.G84SK1aw-lkp@xxxxxxxxx/config)
compiler: sparc64-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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412111151.G84SK1aw-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