lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202503140113.cTWvIvtK-lkp@intel.com>
Date: Fri, 14 Mar 2025 03:04:15 +0800
From: kernel test robot <lkp@...el.com>
To: Rik van Riel <riel@...riel.com>, Corey Minyard <corey@...yard.net>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	"Paul E. McKenney" <paulmck@...nel.org>,
	openipmi-developer@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH] ipmi: fix suspicious RCU usage warning

Hi Rik,

kernel test robot noticed the following build errors:

[auto build test ERROR on v6.14-rc6]
[also build test ERROR on linus/master next-20250313]
[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/Rik-van-Riel/ipmi-fix-suspicious-RCU-usage-warning/20250313-013222
base:   v6.14-rc6
patch link:    https://lore.kernel.org/r/20250312131932.44d901f7%40fangorn
patch subject: [PATCH] ipmi: fix suspicious RCU usage warning
config: i386-randconfig-001-20250313 (https://download.01.org/0day-ci/archive/20250314/202503140113.cTWvIvtK-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250314/202503140113.cTWvIvtK-lkp@intel.com/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 <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503140113.cTWvIvtK-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   drivers/char/ipmi/ipmi_msghandler.c: In function 'ipmi_create_user':
>> drivers/char/ipmi/ipmi_msghandler.c:1238:62: error: macro "list_for_each_entry_srcu" requires 4 arguments, but only 3 given
    1238 |         list_for_each_entry_srcu(intf, &ipmi_interfaces, link) {
         |                                                              ^
   In file included from include/linux/dcache.h:8,
                    from include/linux/fs.h:8,
                    from include/linux/poll.h:10,
                    from drivers/char/ipmi/ipmi_msghandler.c:20:
   include/linux/rculist.h:455: note: macro "list_for_each_entry_srcu" defined here
     455 | #define list_for_each_entry_srcu(pos, head, member, cond)               \
         | 
>> drivers/char/ipmi/ipmi_msghandler.c:1238:9: error: 'list_for_each_entry_srcu' undeclared (first use in this function)
    1238 |         list_for_each_entry_srcu(intf, &ipmi_interfaces, link) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/char/ipmi/ipmi_msghandler.c:1238:9: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/char/ipmi/ipmi_msghandler.c:1238:33: error: expected ';' before '{' token
    1238 |         list_for_each_entry_srcu(intf, &ipmi_interfaces, link) {
         |                                 ^                              ~
         |                                 ;
>> drivers/char/ipmi/ipmi_msghandler.c:1246:2: warning: label 'found' defined but not used [-Wunused-label]
    1246 |  found:
         |  ^~~~~


vim +/list_for_each_entry_srcu +1238 drivers/char/ipmi/ipmi_msghandler.c

  1203	
  1204	int ipmi_create_user(unsigned int          if_num,
  1205			     const struct ipmi_user_hndl *handler,
  1206			     void                  *handler_data,
  1207			     struct ipmi_user      **user)
  1208	{
  1209		unsigned long flags;
  1210		struct ipmi_user *new_user;
  1211		int           rv, index;
  1212		struct ipmi_smi *intf;
  1213	
  1214		/*
  1215		 * There is no module usecount here, because it's not
  1216		 * required.  Since this can only be used by and called from
  1217		 * other modules, they will implicitly use this module, and
  1218		 * thus this can't be removed unless the other modules are
  1219		 * removed.
  1220		 */
  1221	
  1222		if (handler == NULL)
  1223			return -EINVAL;
  1224	
  1225		/*
  1226		 * Make sure the driver is actually initialized, this handles
  1227		 * problems with initialization order.
  1228		 */
  1229		rv = ipmi_init_msghandler();
  1230		if (rv)
  1231			return rv;
  1232	
  1233		new_user = vzalloc(sizeof(*new_user));
  1234		if (!new_user)
  1235			return -ENOMEM;
  1236	
  1237		index = srcu_read_lock(&ipmi_interfaces_srcu);
> 1238		list_for_each_entry_srcu(intf, &ipmi_interfaces, link) {
  1239			if (intf->intf_num == if_num)
  1240				goto found;
  1241		}
  1242		/* Not found, return an error */
  1243		rv = -EINVAL;
  1244		goto out_kfree;
  1245	
> 1246	 found:
  1247		if (atomic_add_return(1, &intf->nr_users) > max_users) {
  1248			rv = -EBUSY;
  1249			goto out_kfree;
  1250		}
  1251	
  1252		INIT_WORK(&new_user->remove_work, free_user_work);
  1253	
  1254		rv = init_srcu_struct(&new_user->release_barrier);
  1255		if (rv)
  1256			goto out_kfree;
  1257	
  1258		if (!try_module_get(intf->owner)) {
  1259			rv = -ENODEV;
  1260			goto out_kfree;
  1261		}
  1262	
  1263		/* Note that each existing user holds a refcount to the interface. */
  1264		kref_get(&intf->refcount);
  1265	
  1266		atomic_set(&new_user->nr_msgs, 0);
  1267		kref_init(&new_user->refcount);
  1268		new_user->handler = handler;
  1269		new_user->handler_data = handler_data;
  1270		new_user->intf = intf;
  1271		new_user->gets_events = false;
  1272	
  1273		rcu_assign_pointer(new_user->self, new_user);
  1274		spin_lock_irqsave(&intf->seq_lock, flags);
  1275		list_add_rcu(&new_user->link, &intf->users);
  1276		spin_unlock_irqrestore(&intf->seq_lock, flags);
  1277		if (handler->ipmi_watchdog_pretimeout)
  1278			/* User wants pretimeouts, so make sure to watch for them. */
  1279			smi_add_watch(intf, IPMI_WATCH_MASK_CHECK_WATCHDOG);
  1280		srcu_read_unlock(&ipmi_interfaces_srcu, index);
  1281		*user = new_user;
  1282		return 0;
  1283	
  1284	out_kfree:
  1285		atomic_dec(&intf->nr_users);
  1286		srcu_read_unlock(&ipmi_interfaces_srcu, index);
  1287		vfree(new_user);
  1288		return rv;
  1289	}
  1290	EXPORT_SYMBOL(ipmi_create_user);
  1291	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ