aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp
diff options
context:
space:
mode:
Diffstat (limited to 'net/l2tp')
-rw-r--r--net/l2tp/l2tp_eth.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index ca1164afeb74..58c6c4cda73b 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -276,43 +276,16 @@ out:
276 276
277static __net_init int l2tp_eth_init_net(struct net *net) 277static __net_init int l2tp_eth_init_net(struct net *net)
278{ 278{
279 struct l2tp_eth_net *pn; 279 struct l2tp_eth_net *pn = net_generic(net, l2tp_eth_net_id);
280 int err;
281
282 pn = kzalloc(sizeof(*pn), GFP_KERNEL);
283 if (!pn)
284 return -ENOMEM;
285 280
286 INIT_LIST_HEAD(&pn->l2tp_eth_dev_list); 281 INIT_LIST_HEAD(&pn->l2tp_eth_dev_list);
287 spin_lock_init(&pn->l2tp_eth_lock); 282 spin_lock_init(&pn->l2tp_eth_lock);
288 283
289 err = net_assign_generic(net, l2tp_eth_net_id, pn);
290 if (err)
291 goto out;
292
293 return 0; 284 return 0;
294
295out:
296 kfree(pn);
297 return err;
298}
299
300static __net_exit void l2tp_eth_exit_net(struct net *net)
301{
302 struct l2tp_eth_net *pn;
303
304 pn = net_generic(net, l2tp_eth_net_id);
305 /*
306 * if someone has cached our net then
307 * further net_generic call will return NULL
308 */
309 net_assign_generic(net, l2tp_eth_net_id, NULL);
310 kfree(pn);
311} 285}
312 286
313static __net_initdata struct pernet_operations l2tp_eth_net_ops = { 287static __net_initdata struct pernet_operations l2tp_eth_net_ops = {
314 .init = l2tp_eth_init_net, 288 .init = l2tp_eth_init_net,
315 .exit = l2tp_eth_exit_net,
316 .id = &l2tp_eth_net_id, 289 .id = &l2tp_eth_net_id,
317 .size = sizeof(struct l2tp_eth_net), 290 .size = sizeof(struct l2tp_eth_net),
318}; 291};