* net/tipc/net.c: TIPC network routing code
  *
  * Copyright (c) 1995-2006, Ericsson AB
- * Copyright (c) 2005, Wind River Systems
+ * Copyright (c) 2005, 2010-2011, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
        tipc_net.nodes = kcalloc(tipc_max_nodes + 1,
                                 sizeof(*tipc_net.nodes), GFP_ATOMIC);
        tipc_net.highest_node = 0;
+       atomic_set(&tipc_net.links, 0);
 
        return tipc_net.nodes ? 0 : -ENOMEM;
 }
 
  * net/tipc/net.h: Include file for TIPC network routing code
  *
  * Copyright (c) 1995-2006, Ericsson AB
- * Copyright (c) 2005, Wind River Systems
+ * Copyright (c) 2005, 2010-2011, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 struct network {
        struct tipc_node **nodes;
        u32 highest_node;
-       u32 links;
+       atomic_t links;
 };
 
 
 
 
                if (!n_ptr->links[bearer_id]) {
                        n_ptr->links[bearer_id] = l_ptr;
-                       tipc_net.links++;
+                       atomic_inc(&tipc_net.links);
                        n_ptr->link_cnt++;
                        return n_ptr;
                }
 void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr)
 {
        n_ptr->links[l_ptr->b_ptr->identity] = NULL;
-       tipc_net.links--;
+       atomic_dec(&tipc_net.links);
        n_ptr->link_cnt--;
 }
 
 
        /* Get space for all unicast links + multicast link */
 
-       payload_size = TLV_SPACE(sizeof(link_info)) * (tipc_net.links + 1);
+       payload_size = TLV_SPACE(sizeof(link_info)) *
+               (atomic_read(&tipc_net.links) + 1);
        if (payload_size > 32768u) {
                read_unlock_bh(&tipc_net_lock);
                return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED