aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm/xfrm_state.c')
-rw-r--r--net/xfrm/xfrm_state.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 268fe3f9e498..81bde76d049c 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -504,13 +504,14 @@ out:
504 504
505static void xfrm_replay_timer_handler(unsigned long data); 505static void xfrm_replay_timer_handler(unsigned long data);
506 506
507struct xfrm_state *xfrm_state_alloc(void) 507struct xfrm_state *xfrm_state_alloc(struct net *net)
508{ 508{
509 struct xfrm_state *x; 509 struct xfrm_state *x;
510 510
511 x = kzalloc(sizeof(struct xfrm_state), GFP_ATOMIC); 511 x = kzalloc(sizeof(struct xfrm_state), GFP_ATOMIC);
512 512
513 if (x) { 513 if (x) {
514 write_pnet(&x->xs_net, net);
514 atomic_set(&x->refcnt, 1); 515 atomic_set(&x->refcnt, 1);
515 atomic_set(&x->tunnel_users, 0); 516 atomic_set(&x->tunnel_users, 0);
516 INIT_LIST_HEAD(&x->km.all); 517 INIT_LIST_HEAD(&x->km.all);
@@ -835,7 +836,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
835 error = -EEXIST; 836 error = -EEXIST;
836 goto out; 837 goto out;
837 } 838 }
838 x = xfrm_state_alloc(); 839 x = xfrm_state_alloc(&init_net);
839 if (x == NULL) { 840 if (x == NULL) {
840 error = -ENOMEM; 841 error = -ENOMEM;
841 goto out; 842 goto out;
@@ -1017,7 +1018,7 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re
1017 if (!create) 1018 if (!create)
1018 return NULL; 1019 return NULL;
1019 1020
1020 x = xfrm_state_alloc(); 1021 x = xfrm_state_alloc(&init_net);
1021 if (likely(x)) { 1022 if (likely(x)) {
1022 switch (family) { 1023 switch (family) {
1023 case AF_INET: 1024 case AF_INET:
@@ -1125,7 +1126,7 @@ EXPORT_SYMBOL(xfrm_state_add);
1125static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp) 1126static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp)
1126{ 1127{
1127 int err = -ENOMEM; 1128 int err = -ENOMEM;
1128 struct xfrm_state *x = xfrm_state_alloc(); 1129 struct xfrm_state *x = xfrm_state_alloc(&init_net);
1129 if (!x) 1130 if (!x)
1130 goto error; 1131 goto error;
1131 1132