diff options
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/node.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 9fcc2fb0ee00..792bbcbb3eed 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -245,23 +245,23 @@ static void tipc_node_get(struct tipc_node *node) | |||
245 | */ | 245 | */ |
246 | static struct tipc_node *tipc_node_find(struct net *net, u32 addr) | 246 | static struct tipc_node *tipc_node_find(struct net *net, u32 addr) |
247 | { | 247 | { |
248 | struct tipc_net *tn = net_generic(net, tipc_net_id); | 248 | struct tipc_net *tn = tipc_net(net); |
249 | struct tipc_node *node; | 249 | struct tipc_node *node; |
250 | unsigned int thash = tipc_hashfn(addr); | ||
250 | 251 | ||
251 | if (unlikely(!in_own_cluster_exact(net, addr))) | 252 | if (unlikely(!in_own_cluster_exact(net, addr))) |
252 | return NULL; | 253 | return NULL; |
253 | 254 | ||
254 | rcu_read_lock(); | 255 | rcu_read_lock(); |
255 | hlist_for_each_entry_rcu(node, &tn->node_htable[tipc_hashfn(addr)], | 256 | hlist_for_each_entry_rcu(node, &tn->node_htable[thash], hash) { |
256 | hash) { | 257 | if (node->addr != addr) |
257 | if (node->addr == addr) { | 258 | continue; |
258 | tipc_node_get(node); | 259 | if (!kref_get_unless_zero(&node->kref)) |
259 | rcu_read_unlock(); | 260 | node = NULL; |
260 | return node; | 261 | break; |
261 | } | ||
262 | } | 262 | } |
263 | rcu_read_unlock(); | 263 | rcu_read_unlock(); |
264 | return NULL; | 264 | return node; |
265 | } | 265 | } |
266 | 266 | ||
267 | static void tipc_node_read_lock(struct tipc_node *n) | 267 | static void tipc_node_read_lock(struct tipc_node *n) |