Skip to contentSkip to conversation

l2tp: add tunnel/session get_next helpers

PATCH kernel test robot 1 participant 1 message Aug 11, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

BCC: [email protected]
CC: [email protected]
In-Reply-To: <4067ff5019040bf8ee2bd3c06db9e3d27ca39ded.1722856576.git.jchapman@katalix.com>
References: <4067ff5019040bf8ee2bd3c06db9e3d27ca39ded.1722856576.git.jchapman@katalix.com>
TO: James Chapman <[email protected]>

Hi James,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/James-Chapman/documentation-networking-update-l2tp-docs/20240805-194031
base:   net-next/main
patch link:    https://lore.kernel.org/r/4067ff5019040bf8ee2bd3c06db9e3d27ca39ded.1722856576.git.jchapman%40katalix.com
patch subject: [PATCH net-next 4/9] l2tp: add tunnel/session get_next helpers

:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: microblaze-randconfig-r073-20240810 (https://download.01.org/0day-ci/archive/20240811/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 14.1.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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
net/l2tp/l2tp_core.c:400 l2tp_v2_session_get_next() error: we previously assumed 'tunnel' could be null (see line 393)

Old smatch warnings:
arch/microblaze/include/asm/thread_info.h:85 current_thread_info() error: uninitialized symbol 'sp'. net/l2tp/l2tp_core.c:1694 l2tp_tunnel_register() warn: missing error code 'ret'

vim +/tunnel +400 net/l2tp/l2tp_core.c

fd558d186df2c1 James Chapman 2010-04-02  371  
1506ceb77b949f James Chapman 2024-08-05  372  static struct l2tp_session *l2tp_v2_session_get_next(const struct net *net, u16 tid, unsigned long *key)
1506ceb77b949f James Chapman 2024-08-05  373  {
1506ceb77b949f James Chapman 2024-08-05  374  	struct l2tp_net *pn = l2tp_pernet(net);
1506ceb77b949f James Chapman 2024-08-05  375  	struct l2tp_session *session = NULL;
1506ceb77b949f James Chapman 2024-08-05  376  
1506ceb77b949f James Chapman 2024-08-05  377  	/* Start searching within the range of the tid */
1506ceb77b949f James Chapman 2024-08-05  378  	if (*key == 0)
1506ceb77b949f James Chapman 2024-08-05  379  		*key = l2tp_v2_session_key(tid, 0);
1506ceb77b949f James Chapman 2024-08-05  380  
1506ceb77b949f James Chapman 2024-08-05  381  	rcu_read_lock_bh();
1506ceb77b949f James Chapman 2024-08-05  382  again:
1506ceb77b949f James Chapman 2024-08-05  383  	session = idr_get_next_ul(&pn->l2tp_v2_session_idr, key);
1506ceb77b949f James Chapman 2024-08-05  384  	if (session) {
1506ceb77b949f James Chapman 2024-08-05  385  		struct l2tp_tunnel *tunnel = READ_ONCE(session->tunnel);
1506ceb77b949f James Chapman 2024-08-05  386  
1506ceb77b949f James Chapman 2024-08-05  387  		/* ignore sessions with id 0 as they are internal for pppol2tp */
1506ceb77b949f James Chapman 2024-08-05  388  		if (session->session_id == 0) {
1506ceb77b949f James Chapman 2024-08-05  389  			(*key)++;
1506ceb77b949f James Chapman 2024-08-05  390  			goto again;
1506ceb77b949f James Chapman 2024-08-05  391  		}
1506ceb77b949f James Chapman 2024-08-05  392  
1506ceb77b949f James Chapman 2024-08-05 @393  		if (tunnel && tunnel->tunnel_id == tid &&
1506ceb77b949f James Chapman 2024-08-05  394  		    refcount_inc_not_zero(&session->ref_count)) {
1506ceb77b949f James Chapman 2024-08-05  395  			rcu_read_unlock_bh();
1506ceb77b949f James Chapman 2024-08-05  396  			return session;
1506ceb77b949f James Chapman 2024-08-05  397  		}
1506ceb77b949f James Chapman 2024-08-05  398  
1506ceb77b949f James Chapman 2024-08-05  399  		(*key)++;
1506ceb77b949f James Chapman 2024-08-05 @400  		if (tunnel->tunnel_id == tid)
1506ceb77b949f James Chapman 2024-08-05  401  			goto again;
1506ceb77b949f James Chapman 2024-08-05  402  	}
1506ceb77b949f James Chapman 2024-08-05  403  	rcu_read_unlock_bh();
1506ceb77b949f James Chapman 2024-08-05  404  
1506ceb77b949f James Chapman 2024-08-05  405  	return NULL;
1506ceb77b949f James Chapman 2024-08-05  406  }
1506ceb77b949f James Chapman 2024-08-05  407  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki