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>
This commit is contained in:
committed by
David S. Miller
parent
50a30657fd
commit
0331b1f383
@@ -228,13 +228,14 @@ expired:
|
||||
* SPD calls.
|
||||
*/
|
||||
|
||||
struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp)
|
||||
struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp)
|
||||
{
|
||||
struct xfrm_policy *policy;
|
||||
|
||||
policy = kzalloc(sizeof(struct xfrm_policy), gfp);
|
||||
|
||||
if (policy) {
|
||||
write_pnet(&policy->xp_net, net);
|
||||
INIT_LIST_HEAD(&policy->walk.all);
|
||||
INIT_HLIST_NODE(&policy->bydst);
|
||||
INIT_HLIST_NODE(&policy->byidx);
|
||||
@@ -1153,7 +1154,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
|
||||
|
||||
static struct xfrm_policy *clone_policy(struct xfrm_policy *old, int dir)
|
||||
{
|
||||
struct xfrm_policy *newp = xfrm_policy_alloc(GFP_ATOMIC);
|
||||
struct xfrm_policy *newp = xfrm_policy_alloc(xp_net(old), GFP_ATOMIC);
|
||||
|
||||
if (newp) {
|
||||
newp->selector = old->selector;
|
||||
|
Reference in New Issue
Block a user