diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-25 20:21:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 20:21:45 -0500 |
commit | 0331b1f383e1fa4049f8e75cafeea8f006171c64 (patch) | |
tree | 69409ab7c17e1527ed063bb4f2eda440e2cb4ea2 /net/xfrm/xfrm_policy.c | |
parent | 50a30657fd7ee77a94a6bf0ad86eba7c37c3032e (diff) |
netns xfrm: add struct xfrm_policy::xp_net
Again, to avoid complications with passing netns when not necessary.
Again, ->xp_net is set-once field, once set it never changes.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index cf2bf3aa7ab4..3eccefae2c8a 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -228,13 +228,14 @@ expired: | |||
228 | * SPD calls. | 228 | * SPD calls. |
229 | */ | 229 | */ |
230 | 230 | ||
231 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp) | 231 | struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp) |
232 | { | 232 | { |
233 | struct xfrm_policy *policy; | 233 | struct xfrm_policy *policy; |
234 | 234 | ||
235 | policy = kzalloc(sizeof(struct xfrm_policy), gfp); | 235 | policy = kzalloc(sizeof(struct xfrm_policy), gfp); |
236 | 236 | ||
237 | if (policy) { | 237 | if (policy) { |
238 | write_pnet(&policy->xp_net, net); | ||
238 | INIT_LIST_HEAD(&policy->walk.all); | 239 | INIT_LIST_HEAD(&policy->walk.all); |
239 | INIT_HLIST_NODE(&policy->bydst); | 240 | INIT_HLIST_NODE(&policy->bydst); |
240 | INIT_HLIST_NODE(&policy->byidx); | 241 | INIT_HLIST_NODE(&policy->byidx); |
@@ -1153,7 +1154,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol) | |||
1153 | 1154 | ||
1154 | static struct xfrm_policy *clone_policy(struct xfrm_policy *old, int dir) | 1155 | static struct xfrm_policy *clone_policy(struct xfrm_policy *old, int dir) |
1155 | { | 1156 | { |
1156 | struct xfrm_policy *newp = xfrm_policy_alloc(GFP_ATOMIC); | 1157 | struct xfrm_policy *newp = xfrm_policy_alloc(xp_net(old), GFP_ATOMIC); |
1157 | 1158 | ||
1158 | if (newp) { | 1159 | if (newp) { |
1159 | newp->selector = old->selector; | 1160 | newp->selector = old->selector; |