aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_state.c9
-rw-r--r--net/xfrm/xfrm_user.c4
2 files changed, 7 insertions, 6 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
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index ee15d5dd6544..65cdaa5c2280 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -320,7 +320,7 @@ static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p,
320 struct nlattr **attrs, 320 struct nlattr **attrs,
321 int *errp) 321 int *errp)
322{ 322{
323 struct xfrm_state *x = xfrm_state_alloc(); 323 struct xfrm_state *x = xfrm_state_alloc(&init_net);
324 int err = -ENOMEM; 324 int err = -ENOMEM;
325 325
326 if (!x) 326 if (!x)
@@ -1663,7 +1663,7 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
1663 struct nlattr *rt = attrs[XFRMA_TMPL]; 1663 struct nlattr *rt = attrs[XFRMA_TMPL];
1664 1664
1665 struct xfrm_user_acquire *ua = nlmsg_data(nlh); 1665 struct xfrm_user_acquire *ua = nlmsg_data(nlh);
1666 struct xfrm_state *x = xfrm_state_alloc(); 1666 struct xfrm_state *x = xfrm_state_alloc(&init_net);
1667 int err = -ENOMEM; 1667 int err = -ENOMEM;
1668 1668
1669 if (!x) 1669 if (!x)