aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_policy.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 3eccefae2c8a..aabc7f28e9c0 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -46,7 +46,6 @@ EXPORT_SYMBOL(xfrm_cfg_mutex);
46 46
47static DEFINE_RWLOCK(xfrm_policy_lock); 47static DEFINE_RWLOCK(xfrm_policy_lock);
48 48
49static struct list_head xfrm_policy_all;
50unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2]; 49unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2];
51EXPORT_SYMBOL(xfrm_policy_count); 50EXPORT_SYMBOL(xfrm_policy_count);
52 51
@@ -615,7 +614,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
615 policy->curlft.use_time = 0; 614 policy->curlft.use_time = 0;
616 if (!mod_timer(&policy->timer, jiffies + HZ)) 615 if (!mod_timer(&policy->timer, jiffies + HZ))
617 xfrm_pol_hold(policy); 616 xfrm_pol_hold(policy);
618 list_add(&policy->walk.all, &xfrm_policy_all); 617 list_add(&policy->walk.all, &init_net.xfrm.policy_all);
619 write_unlock_bh(&xfrm_policy_lock); 618 write_unlock_bh(&xfrm_policy_lock);
620 619
621 if (delpol) 620 if (delpol)
@@ -881,10 +880,10 @@ int xfrm_policy_walk(struct xfrm_policy_walk *walk,
881 880
882 write_lock_bh(&xfrm_policy_lock); 881 write_lock_bh(&xfrm_policy_lock);
883 if (list_empty(&walk->walk.all)) 882 if (list_empty(&walk->walk.all))
884 x = list_first_entry(&xfrm_policy_all, struct xfrm_policy_walk_entry, all); 883 x = list_first_entry(&init_net.xfrm.policy_all, struct xfrm_policy_walk_entry, all);
885 else 884 else
886 x = list_entry(&walk->walk.all, struct xfrm_policy_walk_entry, all); 885 x = list_entry(&walk->walk.all, struct xfrm_policy_walk_entry, all);
887 list_for_each_entry_from(x, &xfrm_policy_all, all) { 886 list_for_each_entry_from(x, &init_net.xfrm.policy_all, all) {
888 if (x->dead) 887 if (x->dead)
889 continue; 888 continue;
890 pol = container_of(x, struct xfrm_policy, walk); 889 pol = container_of(x, struct xfrm_policy, walk);
@@ -1086,7 +1085,7 @@ static void __xfrm_policy_link(struct xfrm_policy *pol, int dir)
1086 struct hlist_head *chain = policy_hash_bysel(&pol->selector, 1085 struct hlist_head *chain = policy_hash_bysel(&pol->selector,
1087 pol->family, dir); 1086 pol->family, dir);
1088 1087
1089 list_add(&pol->walk.all, &xfrm_policy_all); 1088 list_add(&pol->walk.all, &init_net.xfrm.policy_all);
1090 hlist_add_head(&pol->bydst, chain); 1089 hlist_add_head(&pol->bydst, chain);
1091 hlist_add_head(&pol->byidx, xfrm_policy_byidx+idx_hash(pol->index)); 1090 hlist_add_head(&pol->byidx, xfrm_policy_byidx+idx_hash(pol->index));
1092 xfrm_policy_count[dir]++; 1091 xfrm_policy_count[dir]++;
@@ -2426,7 +2425,7 @@ static int __net_init xfrm_policy_init(struct net *net)
2426 panic("XFRM: failed to allocate bydst hash\n"); 2425 panic("XFRM: failed to allocate bydst hash\n");
2427 } 2426 }
2428 2427
2429 INIT_LIST_HEAD(&xfrm_policy_all); 2428 INIT_LIST_HEAD(&net->xfrm.policy_all);
2430 if (net_eq(net, &init_net)) 2429 if (net_eq(net, &init_net))
2431 register_netdevice_notifier(&xfrm_dev_notifier); 2430 register_netdevice_notifier(&xfrm_dev_notifier);
2432 return 0; 2431 return 0;
@@ -2434,6 +2433,7 @@ static int __net_init xfrm_policy_init(struct net *net)
2434 2433
2435static void xfrm_policy_fini(struct net *net) 2434static void xfrm_policy_fini(struct net *net)
2436{ 2435{
2436 WARN_ON(!list_empty(&net->xfrm.policy_all));
2437} 2437}
2438 2438
2439static int __net_init xfrm_net_init(struct net *net) 2439static int __net_init xfrm_net_init(struct net *net)