Skip to content

Commit

Permalink
tipc: use node_list_lock to protect tipc_num_nodes variable
Browse files Browse the repository at this point in the history
As tipc_node_list is protected by rcu read lock on read side, it's
unnecessary to hold node_list_lock to protect tipc_node_list in
tipc_node_get_links(). Instead, node_list_lock should just protects
tipc_num_nodes in the function.

Signed-off-by: Ying Xue <[email protected]>
Reviewed-by: Erik Hugne <[email protected]>
Reviewed-by: Jon Maloy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ying-xue authored and davem330 committed Mar 27, 2014
1 parent 6c7a762 commit 2220646
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/tipc/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,11 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (too many nodes)");
}
spin_unlock_bh(&node_list_lock);

buf = tipc_cfg_reply_alloc(payload_size);
if (!buf) {
spin_unlock_bh(&node_list_lock);
if (!buf)
return NULL;
}

/* Add TLVs for all nodes in scope */
rcu_read_lock();
Expand All @@ -369,7 +369,6 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
&node_info, sizeof(node_info));
}
rcu_read_unlock();
spin_unlock_bh(&node_list_lock);
return buf;
}

Expand Down

0 comments on commit 2220646

Please sign in to comment.