aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/net.c')
-rw-r--r--net/tipc/net.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 3967f1f6d97f..3baf55ee0985 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -112,12 +112,23 @@
112DEFINE_RWLOCK(tipc_net_lock); 112DEFINE_RWLOCK(tipc_net_lock);
113struct network tipc_net; 113struct network tipc_net;
114 114
115static int net_start(void)
116{
117 tipc_net.nodes = kcalloc(tipc_max_nodes + 1,
118 sizeof(*tipc_net.nodes), GFP_ATOMIC);
119 tipc_net.highest_node = 0;
120
121 return tipc_net.nodes ? 0 : -ENOMEM;
122}
123
115static void net_stop(void) 124static void net_stop(void)
116{ 125{
117 u32 c_num; 126 u32 n_num;
118 127
119 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) 128 for (n_num = 1; n_num <= tipc_net.highest_node; n_num++)
120 tipc_cltr_delete(tipc_net.clusters[c_num]); 129 tipc_node_delete(tipc_net.nodes[n_num]);
130 kfree(tipc_net.nodes);
131 tipc_net.nodes = NULL;
121} 132}
122 133
123static void net_route_named_msg(struct sk_buff *buf) 134static void net_route_named_msg(struct sk_buff *buf)
@@ -218,10 +229,12 @@ int tipc_net_start(u32 addr)
218 tipc_named_reinit(); 229 tipc_named_reinit();
219 tipc_port_reinit(); 230 tipc_port_reinit();
220 231
221 if ((res = tipc_cltr_init()) || 232 res = net_start();
222 (res = tipc_bclink_init())) { 233 if (res)
234 return res;
235 res = tipc_bclink_init();
236 if (res)
223 return res; 237 return res;
224 }
225 238
226 tipc_k_signal((Handler)tipc_subscr_start, 0); 239 tipc_k_signal((Handler)tipc_subscr_start, 0);
227 tipc_k_signal((Handler)tipc_cfg_init, 0); 240 tipc_k_signal((Handler)tipc_cfg_init, 0);