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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e602748b-4376-433f-b864-066afa11daf5@stanley.mountain>
Date: Mon, 6 Jan 2025 14:42:48 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev, Ahmed Zaki <ahmed.zaki@...el.com>,
	netdev@...r.kernel.org
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
	intel-wired-lan@...ts.osuosl.org, andrew+netdev@...n.ch,
	edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
	davem@...emloft.net, michael.chan@...adcom.com, tariqt@...dia.com,
	anthony.l.nguyen@...el.com, przemyslaw.kitszel@...el.com,
	jdamato@...tly.com, shayd@...dia.com, akpm@...ux-foundation.org,
	Ahmed Zaki <ahmed.zaki@...el.com>
Subject: Re: [Intel-wired-lan] [PATCH net-next v3 3/6] net: napi: add CPU
 affinity to napi_config

Hi Ahmed,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Ahmed-Zaki/net-move-ARFS-rmap-management-to-core/20250104-084501
base:   net-next/main
patch link:    https://lore.kernel.org/r/20250104004314.208259-4-ahmed.zaki%40intel.com
patch subject: [Intel-wired-lan] [PATCH net-next v3 3/6] net: napi: add CPU affinity to napi_config
config: i386-randconfig-141-20250104 (https://download.01.org/0day-ci/archive/20250105/202501050625.nY1c97EX-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)

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>
| Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
| Closes: https://lore.kernel.org/r/202501050625.nY1c97EX-lkp@intel.com/

smatch warnings:
net/core/dev.c:6835 napi_restore_config() warn: variable dereferenced before check 'n->config' (see line 6831)
net/core/dev.c:6855 napi_save_config() warn: variable dereferenced before check 'n->config' (see line 6850)

vim +6835 net/core/dev.c

86e25f40aa1e9e5 Joe Damato     2024-10-11  6829  static void napi_restore_config(struct napi_struct *n)
86e25f40aa1e9e5 Joe Damato     2024-10-11  6830  {
86e25f40aa1e9e5 Joe Damato     2024-10-11 @6831  	n->defer_hard_irqs = n->config->defer_hard_irqs;
86e25f40aa1e9e5 Joe Damato     2024-10-11  6832  	n->gro_flush_timeout = n->config->gro_flush_timeout;
5dc51ec86df6e22 Martin Karsten 2024-11-09  6833  	n->irq_suspend_timeout = n->config->irq_suspend_timeout;
                                                                                 ^^^^^^^^^
These lines all dereference n->config.

d6b43b8a2e5297b Ahmed Zaki     2025-01-03  6834  
d6b43b8a2e5297b Ahmed Zaki     2025-01-03 @6835  	if (n->irq > 0 && n->config && n->dev->irq_affinity_auto)
                                                                          ^^^^^^^^^
This code assumes it can be NULL

d6b43b8a2e5297b Ahmed Zaki     2025-01-03  6836  		irq_set_affinity(n->irq, &n->config->affinity_mask);
d6b43b8a2e5297b Ahmed Zaki     2025-01-03  6837  
86e25f40aa1e9e5 Joe Damato     2024-10-11  6838  	/* a NAPI ID might be stored in the config, if so use it. if not, use
86e25f40aa1e9e5 Joe Damato     2024-10-11  6839  	 * napi_hash_add to generate one for us. It will be saved to the config
86e25f40aa1e9e5 Joe Damato     2024-10-11  6840  	 * in napi_disable.
86e25f40aa1e9e5 Joe Damato     2024-10-11  6841  	 */
86e25f40aa1e9e5 Joe Damato     2024-10-11  6842  	if (n->config->napi_id)
86e25f40aa1e9e5 Joe Damato     2024-10-11  6843  		napi_hash_add_with_id(n, n->config->napi_id);
86e25f40aa1e9e5 Joe Damato     2024-10-11  6844  	else
86e25f40aa1e9e5 Joe Damato     2024-10-11  6845  		napi_hash_add(n);
86e25f40aa1e9e5 Joe Damato     2024-10-11  6846  }
86e25f40aa1e9e5 Joe Damato     2024-10-11  6847  
86e25f40aa1e9e5 Joe Damato     2024-10-11  6848  static void napi_save_config(struct napi_struct *n)
86e25f40aa1e9e5 Joe Damato     2024-10-11  6849  {
86e25f40aa1e9e5 Joe Damato     2024-10-11 @6850  	n->config->defer_hard_irqs = n->defer_hard_irqs;
86e25f40aa1e9e5 Joe Damato     2024-10-11  6851  	n->config->gro_flush_timeout = n->gro_flush_timeout;
5dc51ec86df6e22 Martin Karsten 2024-11-09  6852  	n->config->irq_suspend_timeout = n->irq_suspend_timeout;
86e25f40aa1e9e5 Joe Damato     2024-10-11  6853  	n->config->napi_id = n->napi_id;
d6b43b8a2e5297b Ahmed Zaki     2025-01-03  6854  
d6b43b8a2e5297b Ahmed Zaki     2025-01-03 @6855  	if (n->irq > 0 && n->config && n->dev->irq_affinity_auto)

Same

d6b43b8a2e5297b Ahmed Zaki     2025-01-03  6856  		irq_set_affinity_notifier(n->irq, NULL);
d6b43b8a2e5297b Ahmed Zaki     2025-01-03  6857  
86e25f40aa1e9e5 Joe Damato     2024-10-11  6858  	napi_hash_del(n);
86e25f40aa1e9e5 Joe Damato     2024-10-11  6859  }

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