Skip to content

Commit

Permalink
tipc: correct usage of spin_lock() vs spin_lock_bh()
Browse files Browse the repository at this point in the history
I commit e099e86
("tipc: add node_lock protection to link lookup function")
we are calling spin_lock(&node->lock) directly instead of indirectly
via the tipc_node_lock(node) function. However, tipc_node_lock() is
using spin_lock_bh(), not spin_lock(), something leading to
unbalanced usage in one place, and a smatch warning.

We fix this by consistently using tipc_node_lock()/unlock() in
in the places touched by the mentioned commit.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jon Paul Maloy authored and David S. Miller committed Feb 17, 2014
1 parent 074bb43 commit a11607f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/tipc/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,7 @@ static struct tipc_node *tipc_link_find_owner(const char *link_name,

*bearer_id = 0;
list_for_each_entry_safe(n_ptr, tmp_n_ptr, &tipc_node_list, list) {
spin_lock(&n_ptr->lock);
tipc_node_lock(n_ptr);
for (i = 0; i < MAX_BEARERS; i++) {
l_ptr = n_ptr->links[i];
if (l_ptr && !strcmp(l_ptr->name, link_name)) {
Expand All @@ -2419,7 +2419,7 @@ static struct tipc_node *tipc_link_find_owner(const char *link_name,
break;
}
}
spin_unlock(&n_ptr->lock);
tipc_node_unlock(n_ptr);
if (found_node)
break;
}
Expand Down Expand Up @@ -2603,7 +2603,7 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
read_unlock_bh(&tipc_net_lock);
return tipc_cfg_reply_error_string("link not found");
}
spin_lock(&node->lock);
tipc_node_lock(node);
l_ptr = node->links[bearer_id];
if (!l_ptr) {
tipc_node_unlock(node);
Expand Down

0 comments on commit a11607f

Please sign in to comment.