diff options
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index d4cb8c127063..842bd7ad4b17 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -96,14 +96,14 @@ struct tipc_node *tipc_node_create(struct net *net, u32 addr) | |||
96 | struct tipc_node *n_ptr, *temp_node; | 96 | struct tipc_node *n_ptr, *temp_node; |
97 | 97 | ||
98 | spin_lock_bh(&tn->node_list_lock); | 98 | spin_lock_bh(&tn->node_list_lock); |
99 | 99 | n_ptr = tipc_node_find(net, addr); | |
100 | if (n_ptr) | ||
101 | goto exit; | ||
100 | n_ptr = kzalloc(sizeof(*n_ptr), GFP_ATOMIC); | 102 | n_ptr = kzalloc(sizeof(*n_ptr), GFP_ATOMIC); |
101 | if (!n_ptr) { | 103 | if (!n_ptr) { |
102 | spin_unlock_bh(&tn->node_list_lock); | ||
103 | pr_warn("Node creation failed, no memory\n"); | 104 | pr_warn("Node creation failed, no memory\n"); |
104 | return NULL; | 105 | goto exit; |
105 | } | 106 | } |
106 | |||
107 | n_ptr->addr = addr; | 107 | n_ptr->addr = addr; |
108 | n_ptr->net = net; | 108 | n_ptr->net = net; |
109 | spin_lock_init(&n_ptr->lock); | 109 | spin_lock_init(&n_ptr->lock); |
@@ -123,9 +123,8 @@ struct tipc_node *tipc_node_create(struct net *net, u32 addr) | |||
123 | list_add_tail_rcu(&n_ptr->list, &temp_node->list); | 123 | list_add_tail_rcu(&n_ptr->list, &temp_node->list); |
124 | n_ptr->action_flags = TIPC_WAIT_PEER_LINKS_DOWN; | 124 | n_ptr->action_flags = TIPC_WAIT_PEER_LINKS_DOWN; |
125 | n_ptr->signature = INVALID_NODE_SIG; | 125 | n_ptr->signature = INVALID_NODE_SIG; |
126 | |||
127 | tn->num_nodes++; | 126 | tn->num_nodes++; |
128 | 127 | exit: | |
129 | spin_unlock_bh(&tn->node_list_lock); | 128 | spin_unlock_bh(&tn->node_list_lock); |
130 | return n_ptr; | 129 | return n_ptr; |
131 | } | 130 | } |