All of lore.kernel.org
 help / color / mirror / Atom feed
* [jgunthorpe:pcie_switch_groups 3/13] drivers/iommu/iommu.c:1021 iommu_group_alloc_data() warn: Calling kobject_put|get with state->initialized unset from line: 1000
@ 2025-09-15  6:49 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-09-15  6:49 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Jason Gunthorpe <jgg@nvidia.com>

tree:   https://github.com/jgunthorpe/linux pcie_switch_groups
head:   bf8d5a37268d05065ff20a424747073107e242d4
commit: d123f7b734f1c0db1137f31721ded0b79e551611 [3/13] iommu: Add iommu_group bus_data
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: openrisc-randconfig-r073-20250914 (https://download.01.org/0day-ci/archive/20250915/202509151452.LdffxDB3-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.3.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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202509151452.LdffxDB3-lkp@intel.com/

New smatch warnings:
drivers/iommu/iommu.c:1021 iommu_group_alloc_data() warn: Calling kobject_put|get with state->initialized unset from line: 1000

Old smatch warnings:
drivers/iommu/iommu.c:1027 iommu_group_alloc_data() warn: Calling kobject_put|get with state->initialized unset from line: 1000
drivers/iommu/iommu.c:1036 iommu_group_alloc_data() warn: Calling kobject_put|get with state->initialized unset from line: 1000

vim +1021 drivers/iommu/iommu.c

d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30   994  
d123f7b734f1c0 drivers/iommu/iommu.c Jason Gunthorpe 2025-09-09   995  static struct iommu_group *iommu_group_alloc_data(u32 bus_data)
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30   996  {
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30   997  	struct iommu_group *group;
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30   998  	int ret;
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30   999  
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1000  	group = kzalloc(sizeof(*group), GFP_KERNEL);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1001  	if (!group)
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1002  		return ERR_PTR(-ENOMEM);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1003  
d123f7b734f1c0 drivers/iommu/iommu.c Jason Gunthorpe 2025-09-09  1004  	group->bus_data = bus_data;
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1005  	group->kobj.kset = iommu_group_kset;
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1006  	mutex_init(&group->mutex);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1007  	INIT_LIST_HEAD(&group->devices);
41df6dcc0a3ff4 drivers/iommu/iommu.c Joerg Roedel    2020-04-29  1008  	INIT_LIST_HEAD(&group->entry);
16603704559c7a drivers/iommu/iommu.c Lu Baolu        2022-10-31  1009  	xa_init(&group->pasid_array);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1010  
822242e649ea9f drivers/iommu/iommu.c Ke Liu          2022-06-08  1011  	ret = ida_alloc(&iommu_group_ida, GFP_KERNEL);
feccf398db631f drivers/iommu/iommu.c Heiner Kallweit 2016-06-29  1012  	if (ret < 0) {
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1013  		kfree(group);
feccf398db631f drivers/iommu/iommu.c Heiner Kallweit 2016-06-29  1014  		return ERR_PTR(ret);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1015  	}
feccf398db631f drivers/iommu/iommu.c Heiner Kallweit 2016-06-29  1016  	group->id = ret;
fc2100eb4d0960 drivers/base/iommu.c  Joerg Roedel    2008-11-26  1017  
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1018  	ret = kobject_init_and_add(&group->kobj, &iommu_group_ktype,
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1019  				   NULL, "%d", group->id);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1020  	if (ret) {
7cc31613734c48 drivers/iommu/iommu.c Qiushi Wu       2020-05-27 @1021  		kobject_put(&group->kobj);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1022  		return ERR_PTR(ret);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1023  	}
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1024  
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1025  	group->devices_kobj = kobject_create_and_add("devices", &group->kobj);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1026  	if (!group->devices_kobj) {
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1027  		kobject_put(&group->kobj); /* triggers .release & free */
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1028  		return ERR_PTR(-ENOMEM);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1029  	}
fc2100eb4d0960 drivers/base/iommu.c  Joerg Roedel    2008-11-26  1030  
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1031  	/*
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1032  	 * The devices_kobj holds a reference on the group kobject, so
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1033  	 * as long as that exists so will the group.  We can therefore
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1034  	 * use the devices_kobj for reference counting.
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1035  	 */
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1036  	kobject_put(&group->kobj);
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1037  
bc7d12b91bd354 drivers/iommu/iommu.c Eric Auger      2017-01-19  1038  	ret = iommu_group_create_file(group,
bc7d12b91bd354 drivers/iommu/iommu.c Eric Auger      2017-01-19  1039  				      &iommu_group_attr_reserved_regions);
4daa861174d560 drivers/iommu/iommu.c Jason Gunthorpe 2023-02-15  1040  	if (ret) {
4daa861174d560 drivers/iommu/iommu.c Jason Gunthorpe 2023-02-15  1041  		kobject_put(group->devices_kobj);
bc7d12b91bd354 drivers/iommu/iommu.c Eric Auger      2017-01-19  1042  		return ERR_PTR(ret);
4daa861174d560 drivers/iommu/iommu.c Jason Gunthorpe 2023-02-15  1043  	}
bc7d12b91bd354 drivers/iommu/iommu.c Eric Auger      2017-01-19  1044  
c52c72d3dee81a drivers/iommu/iommu.c Olof Johansson  2018-07-11  1045  	ret = iommu_group_create_file(group, &iommu_group_attr_type);
4daa861174d560 drivers/iommu/iommu.c Jason Gunthorpe 2023-02-15  1046  	if (ret) {
4daa861174d560 drivers/iommu/iommu.c Jason Gunthorpe 2023-02-15  1047  		kobject_put(group->devices_kobj);
c52c72d3dee81a drivers/iommu/iommu.c Olof Johansson  2018-07-11  1048  		return ERR_PTR(ret);
4daa861174d560 drivers/iommu/iommu.c Jason Gunthorpe 2023-02-15  1049  	}
c52c72d3dee81a drivers/iommu/iommu.c Olof Johansson  2018-07-11  1050  
269aa808a990b3 drivers/iommu/iommu.c Joerg Roedel    2015-05-28  1051  	pr_debug("Allocated group %d\n", group->id);
269aa808a990b3 drivers/iommu/iommu.c Joerg Roedel    2015-05-28  1052  
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1053  	return group;
d72e31c9374627 drivers/iommu/iommu.c Alex Williamson 2012-05-30  1054  }
d123f7b734f1c0 drivers/iommu/iommu.c Jason Gunthorpe 2025-09-09  1055  

:::::: The code at line 1021 was first introduced by commit
:::::: 7cc31613734c4870ae32f5265d576ef296621343 iommu: Fix reference count leak in iommu_group_alloc.

:::::: TO: Qiushi Wu <wu000273@umn.edu>
:::::: CC: Joerg Roedel <jroedel@suse.de>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-15  6:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-15  6:49 [jgunthorpe:pcie_switch_groups 3/13] drivers/iommu/iommu.c:1021 iommu_group_alloc_data() warn: Calling kobject_put|get with state->initialized unset from line: 1000 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.