Re: [PATCH] target: iscsi: cxgbit: fix cnp kref leak in __cxgbit_free_cdev_np()

kernel test robot <[email protected]> Thu, 28 May 2026 04:05:45 +0200
Newsgroups org.kernel.vger.target-devel,dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel,org.kernel.vger.linux-scsi,org.kernel.vger.stable
Message-ID <[email protected]>
Hi Wentao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on kees/for-next/pstore kees/for-next/kspp linus/master v7.1-rc5 next-20260527]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Wentao-Liang/target-iscsi-cxgbit-fix-cnp-kref-leak-in-__cxgbit_free_cdev_np/20260527-184050
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link:    https://lore.kernel.org/r/20260527103823.869792-1-vulab%40iscas.ac.cn
patch subject: [PATCH] target: iscsi: cxgbit: fix cnp kref leak in __cxgbit_free_cdev_np()
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260528/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/[email protected]/reproduce)

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]/

All warnings (new ones prefixed by >>):

   drivers/target/iscsi/cxgbit/cxgbit_cm.c: In function '__cxgbit_free_cdev_np':
>> drivers/target/iscsi/cxgbit/cxgbit_cm.c:547:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     547 |         if (ret == -ETIMEDOUT)
         |         ^~
   drivers/target/iscsi/cxgbit/cxgbit_cm.c:549:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     549 |                 return ret;
         |                 ^~~~~~


vim +/if +547 drivers/target/iscsi/cxgbit/cxgbit_cm.c

9730ffcb8957e1 Varun Prakash 2016-04-20  516  
9730ffcb8957e1 Varun Prakash 2016-04-20  517  static int
9730ffcb8957e1 Varun Prakash 2016-04-20  518  __cxgbit_free_cdev_np(struct cxgbit_device *cdev, struct cxgbit_np *cnp)
9730ffcb8957e1 Varun Prakash 2016-04-20  519  {
9730ffcb8957e1 Varun Prakash 2016-04-20  520  	int stid, ret;
9730ffcb8957e1 Varun Prakash 2016-04-20  521  	bool ipv6 = false;
9730ffcb8957e1 Varun Prakash 2016-04-20  522  
9730ffcb8957e1 Varun Prakash 2016-04-20  523  	stid = cxgbit_np_hash_del(cdev, cnp);
9730ffcb8957e1 Varun Prakash 2016-04-20  524  	if (stid < 0)
9730ffcb8957e1 Varun Prakash 2016-04-20  525  		return -EINVAL;
9730ffcb8957e1 Varun Prakash 2016-04-20  526  	if (!test_bit(CDEV_STATE_UP, &cdev->flags))
9730ffcb8957e1 Varun Prakash 2016-04-20  527  		return -EINVAL;
9730ffcb8957e1 Varun Prakash 2016-04-20  528  
9730ffcb8957e1 Varun Prakash 2016-04-20  529  	if (cnp->np->np_sockaddr.ss_family == AF_INET6)
9730ffcb8957e1 Varun Prakash 2016-04-20  530  		ipv6 = true;
9730ffcb8957e1 Varun Prakash 2016-04-20  531  
9730ffcb8957e1 Varun Prakash 2016-04-20  532  	cxgbit_get_cnp(cnp);
9730ffcb8957e1 Varun Prakash 2016-04-20  533  	cxgbit_init_wr_wait(&cnp->com.wr_wait);
9730ffcb8957e1 Varun Prakash 2016-04-20  534  	ret = cxgb4_remove_server(cdev->lldi.ports[0], stid,
9730ffcb8957e1 Varun Prakash 2016-04-20  535  				  cdev->lldi.rxq_ids[0], ipv6);
9730ffcb8957e1 Varun Prakash 2016-04-20  536  
9730ffcb8957e1 Varun Prakash 2016-04-20  537  	if (ret > 0)
9730ffcb8957e1 Varun Prakash 2016-04-20  538  		ret = net_xmit_errno(ret);
9730ffcb8957e1 Varun Prakash 2016-04-20  539  
9730ffcb8957e1 Varun Prakash 2016-04-20  540  	if (ret) {
9730ffcb8957e1 Varun Prakash 2016-04-20  541  		cxgbit_put_cnp(cnp);
9730ffcb8957e1 Varun Prakash 2016-04-20  542  		return ret;
9730ffcb8957e1 Varun Prakash 2016-04-20  543  	}
9730ffcb8957e1 Varun Prakash 2016-04-20  544  
9730ffcb8957e1 Varun Prakash 2016-04-20  545  	ret = cxgbit_wait_for_reply(cdev, &cnp->com.wr_wait,
9730ffcb8957e1 Varun Prakash 2016-04-20  546  				    0, 10, __func__);
9730ffcb8957e1 Varun Prakash 2016-04-20 @547  	if (ret == -ETIMEDOUT)
956027c993d5b2 Wentao Liang  2026-05-27  548  		cxgbit_put_cnp(cnp);
9730ffcb8957e1 Varun Prakash 2016-04-20  549  		return ret;
9730ffcb8957e1 Varun Prakash 2016-04-20  550  
9730ffcb8957e1 Varun Prakash 2016-04-20  551  	if (ipv6 && cnp->com.cdev) {
9730ffcb8957e1 Varun Prakash 2016-04-20  552  		struct sockaddr_in6 *sin6;
9730ffcb8957e1 Varun Prakash 2016-04-20  553  
9730ffcb8957e1 Varun Prakash 2016-04-20  554  		sin6 = (struct sockaddr_in6 *)&cnp->com.local_addr;
9730ffcb8957e1 Varun Prakash 2016-04-20  555  		cxgb4_clip_release(cdev->lldi.ports[0],
9730ffcb8957e1 Varun Prakash 2016-04-20  556  				   (const u32 *)&sin6->sin6_addr.s6_addr,
9730ffcb8957e1 Varun Prakash 2016-04-20  557  				   1);
9730ffcb8957e1 Varun Prakash 2016-04-20  558  	}
9730ffcb8957e1 Varun Prakash 2016-04-20  559  
9730ffcb8957e1 Varun Prakash 2016-04-20  560  	cxgb4_free_stid(cdev->lldi.tids, stid,
9730ffcb8957e1 Varun Prakash 2016-04-20  561  			cnp->com.local_addr.ss_family);
956027c993d5b2 Wentao Liang  2026-05-27  562  	cxgbit_put_cnp(cnp);
9730ffcb8957e1 Varun Prakash 2016-04-20  563  	return 0;
9730ffcb8957e1 Varun Prakash 2016-04-20  564  }
9730ffcb8957e1 Varun Prakash 2016-04-20  565  

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