[tnguy-net-queue:main 7/7] net/tipc/node.c:1099 tipc_node_link_down() warn: inconsistent returns '&n->lock'.

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
CC: Intel Wired LAN <[email protected]>
TO: Jun Yang <[email protected]>
CC: Paolo Abeni <[email protected]>
CC: Tung Nguyen <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue.git main
head:   cba9ccb47e9fa4cc77692fb896cc5ab57a667882
commit: cba9ccb47e9fa4cc77692fb896cc5ab57a667882 [7/7] tipc: read le->link under the node lock in tipc_node_link_down()
:::::: branch date: 31 hours ago
:::::: commit date: 31 hours ago
config: x86_64-randconfig-161-20260812 (https://download.01.org/0day-ci/archive/20260813/[email protected]/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
smatch: v0.5.0-9187-g5189e3fb

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

smatch warnings:
net/tipc/node.c:1099 tipc_node_link_down() warn: inconsistent returns '&n->lock'.
net/tipc/node.c:1099 tipc_node_link_down() warn: inconsistent returns 'bh'.

vim +1099 net/tipc/node.c

598411d70f85dc Jon Paul Maloy 2015-07-30  1061  
598411d70f85dc Jon Paul Maloy 2015-07-30  1062  static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete)
598411d70f85dc Jon Paul Maloy 2015-07-30  1063  {
737889efe9713a Jon Maloy      2019-03-22  1064  	struct tipc_media_addr *maddr = NULL;
35c55c9877f8de Jon Paul Maloy 2016-06-13  1065  	int old_bearer_id = bearer_id;
cba9ccb47e9fa4 Jun Yang       2026-08-10  1066  	struct tipc_link_entry *le;
737889efe9713a Jon Maloy      2019-03-22  1067  	struct sk_buff_head xmitq;
cba9ccb47e9fa4 Jun Yang       2026-08-10  1068  	struct tipc_link *l;
73f646cec35477 Jon Paul Maloy 2015-10-15  1069  
598411d70f85dc Jon Paul Maloy 2015-07-30  1070  	__skb_queue_head_init(&xmitq);
598411d70f85dc Jon Paul Maloy 2015-07-30  1071  
cba9ccb47e9fa4 Jun Yang       2026-08-10  1072  	/* Synchronize the link lookup with bearer teardown. */
5405ff6e15f40f Jon Paul Maloy 2015-11-19  1073  	tipc_node_write_lock(n);
cba9ccb47e9fa4 Jun Yang       2026-08-10  1074  	le = &n->links[bearer_id];
cba9ccb47e9fa4 Jun Yang       2026-08-10  1075  	l = le->link;
cba9ccb47e9fa4 Jun Yang       2026-08-10  1076  	if (!l) {
cba9ccb47e9fa4 Jun Yang       2026-08-10  1077  		tipc_node_write_unlock_fast(n);
cba9ccb47e9fa4 Jun Yang       2026-08-10  1078  		return;
cba9ccb47e9fa4 Jun Yang       2026-08-10  1079  	}
cba9ccb47e9fa4 Jun Yang       2026-08-10  1080  
73f646cec35477 Jon Paul Maloy 2015-10-15  1081  	if (!tipc_link_is_establishing(l)) {
598411d70f85dc Jon Paul Maloy 2015-07-30  1082  		__tipc_node_link_down(n, &bearer_id, &xmitq, &maddr);
91986ee166cf08 Tuong Lien     2019-02-11  1083  	} else {
91986ee166cf08 Tuong Lien     2019-02-11  1084  		/* Defuse pending tipc_node_link_up() */
91986ee166cf08 Tuong Lien     2019-02-11  1085  		tipc_link_reset(l);
91986ee166cf08 Tuong Lien     2019-02-11  1086  		tipc_link_fsm_evt(l, LINK_RESET_EVT);
91986ee166cf08 Tuong Lien     2019-02-11  1087  	}
73f646cec35477 Jon Paul Maloy 2015-10-15  1088  	if (delete) {
73f646cec35477 Jon Paul Maloy 2015-10-15  1089  		kfree(l);
598411d70f85dc Jon Paul Maloy 2015-07-30  1090  		le->link = NULL;
598411d70f85dc Jon Paul Maloy 2015-07-30  1091  		n->link_cnt--;
598411d70f85dc Jon Paul Maloy 2015-07-30  1092  	}
eb18a510b5cd4d Tuong Lien     2018-12-19  1093  	trace_tipc_node_link_down(n, true, "node link down or deleted!");
5405ff6e15f40f Jon Paul Maloy 2015-11-19  1094  	tipc_node_write_unlock(n);
35c55c9877f8de Jon Paul Maloy 2016-06-13  1095  	if (delete)
35c55c9877f8de Jon Paul Maloy 2016-06-13  1096  		tipc_mon_remove_peer(n->net, n->addr, old_bearer_id);
737889efe9713a Jon Maloy      2019-03-22  1097  	if (!skb_queue_empty(&xmitq))
fc1b6d6de22087 Tuong Lien     2019-11-08  1098  		tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr, n);
598411d70f85dc Jon Paul Maloy 2015-07-30 @1099  	tipc_sk_rcv(n->net, &le->inputq);
b97bf3fd8f6a16 Per Liden      2006-01-02  1100  }
b97bf3fd8f6a16 Per Liden      2006-01-02  1101  

:::::: The code at line 1099 was first introduced by commit
:::::: 598411d70f85dcf5b5c6c2369cc48637c251b656 tipc: make resetting of links non-atomic

:::::: TO: Jon Paul Maloy <[email protected]>
:::::: CC: David S. Miller <[email protected]>

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