/*
  * net/tipc/discover.c
  *
- * Copyright (c) 2003-2006, 2014, Ericsson AB
+ * Copyright (c) 2003-2006, 2014-2015, Ericsson AB
  * Copyright (c) 2005-2006, 2010-2011, Wind River Systems
  * All rights reserved.
  *
 /* indicates no timer in use */
 #define TIPC_LINK_REQ_INACTIVE 0xffffffff
 
-
 /**
  * struct tipc_link_req - information about an ongoing link setup request
  * @bearer_id: identity of bearer issuing requests
        if (!tipc_in_scope(bearer->domain, onode))
                return;
 
-       /* Locate, or if necessary, create, node: */
-       node = tipc_node_find(net, onode);
-       if (!node)
-               node = tipc_node_create(net, onode);
+       node = tipc_node_create(net, onode);
        if (!node)
                return;
-
        tipc_node_lock(node);
        link = node->links[bearer->identity];
 
 
        struct tipc_node *n_ptr, *temp_node;
 
        spin_lock_bh(&tn->node_list_lock);
-
+       n_ptr = tipc_node_find(net, addr);
+       if (n_ptr)
+               goto exit;
        n_ptr = kzalloc(sizeof(*n_ptr), GFP_ATOMIC);
        if (!n_ptr) {
-               spin_unlock_bh(&tn->node_list_lock);
                pr_warn("Node creation failed, no memory\n");
-               return NULL;
+               goto exit;
        }
-
        n_ptr->addr = addr;
        n_ptr->net = net;
        spin_lock_init(&n_ptr->lock);
        list_add_tail_rcu(&n_ptr->list, &temp_node->list);
        n_ptr->action_flags = TIPC_WAIT_PEER_LINKS_DOWN;
        n_ptr->signature = INVALID_NODE_SIG;
-
        tn->num_nodes++;
-
+exit:
        spin_unlock_bh(&tn->node_list_lock);
        return n_ptr;
 }