Re: [PATCH] RDMA/rtrs-clt: Fix double free on path sysfs failure

kernel test robot <[email protected]>
Newsgroups org.kernel.vger.linux-rdma,dev.linux.lists.llvm,dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Guangshuo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rdma/for-next]
[also build test WARNING on linus/master v7.2 next-20260819]
[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/Guangshuo-Li/RDMA-rtrs-clt-Fix-double-free-on-path-sysfs-failure/20260815-173725
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
patch link:    https://lore.kernel.org/r/20260714142838.1723076-1-lgs201920130244%40gmail.com
patch subject: [PATCH] RDMA/rtrs-clt: Fix double free on path sysfs failure
config: i386-buildonly-randconfig-004-20260820 (https://download.01.org/0day-ci/archive/20260820/[email protected]/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260820/[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/infiniband/ulp/rtrs/rtrs-clt-sysfs.c:470:1: warning: unused label 'del_kobj' [-Wunused-label]
     470 | del_kobj:
         | ^~~~~~~~~
   1 warning generated.


vim +/del_kobj +470 drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c

   424	
   425	int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path)
   426	{
   427		struct rtrs_clt_sess *clt = clt_path->clt;
   428		char str[NAME_MAX];
   429		int err;
   430		struct rtrs_addr path = {
   431			.src = &clt_path->s.src_addr,
   432			.dst = &clt_path->s.dst_addr,
   433		};
   434	
   435		rtrs_addr_to_str(&path, str, sizeof(str));
   436		err = kobject_init_and_add(&clt_path->kobj, &ktype_sess,
   437					   clt->kobj_paths,
   438					   "%s", str);
   439		if (err) {
   440			pr_err("kobject_init_and_add: %pe\n", ERR_PTR(err));
   441			goto free_stats;
   442		}
   443		err = sysfs_create_group(&clt_path->kobj, &rtrs_clt_path_attr_group);
   444		if (err) {
   445			pr_err("sysfs_create_group(): %pe\n", ERR_PTR(err));
   446			goto del_kobj_free_stats;
   447		}
   448		err = kobject_init_and_add(&clt_path->stats->kobj_stats, &ktype_stats,
   449					   &clt_path->kobj, "stats");
   450		if (err) {
   451			pr_err("kobject_init_and_add: %pe\n", ERR_PTR(err));
   452			kobject_put(&clt_path->stats->kobj_stats);
   453			goto remove_group;
   454		}
   455	
   456		err = sysfs_create_group(&clt_path->stats->kobj_stats,
   457					 &rtrs_clt_stats_attr_group);
   458		if (err) {
   459			pr_err("failed to create stats sysfs group, err: %pe\n", ERR_PTR(err));
   460			goto put_kobj_stats;
   461		}
   462	
   463		return 0;
   464	
   465	put_kobj_stats:
   466		kobject_del(&clt_path->stats->kobj_stats);
   467		kobject_put(&clt_path->stats->kobj_stats);
   468	remove_group:
   469		sysfs_remove_group(&clt_path->kobj, &rtrs_clt_path_attr_group);
 > 470	del_kobj:
   471		kobject_del(&clt_path->kobj);
   472		return err;
   473	
   474	del_kobj_free_stats:
   475		kobject_del(&clt_path->kobj);
   476	free_stats:
   477		free_percpu(clt_path->stats->pcpu_stats);
   478		kfree(clt_path->stats);
   479	
   480		/*
   481		 * Leave the path kobject reference to the caller so it can tear
   482		 * down the connections before rtrs_clt_path_release() frees it.
   483		 */
   484	
   485		return err;
   486	}
   487	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.