]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/xfrm/xfrm_policy.c
Merge tag 'ecryptfs-5.3-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / net / xfrm / xfrm_policy.c
index b1694d5d15d350b4f53175f0e1c49dfee6efc972..8ca637a72697491863bf2f6f606c7a669932847f 100644 (file)
@@ -582,9 +582,6 @@ static void xfrm_bydst_resize(struct net *net, int dir)
        spin_lock_bh(&net->xfrm.xfrm_policy_lock);
        write_seqcount_begin(&xfrm_policy_hash_generation);
 
-       odst = rcu_dereference_protected(net->xfrm.policy_bydst[dir].table,
-                               lockdep_is_held(&net->xfrm.xfrm_policy_lock));
-
        odst = rcu_dereference_protected(net->xfrm.policy_bydst[dir].table,
                                lockdep_is_held(&net->xfrm.xfrm_policy_lock));
 
@@ -1280,13 +1277,17 @@ static void xfrm_hash_rebuild(struct work_struct *work)
 
                hlist_for_each_entry_safe(policy, n,
                                          &net->xfrm.policy_inexact[dir],
-                                         bydst_inexact_list)
+                                         bydst_inexact_list) {
+                       hlist_del_rcu(&policy->bydst);
                        hlist_del_init(&policy->bydst_inexact_list);
+               }
 
                hmask = net->xfrm.policy_bydst[dir].hmask;
                odst = net->xfrm.policy_bydst[dir].table;
-               for (i = hmask; i >= 0; i--)
-                       INIT_HLIST_HEAD(odst + i);
+               for (i = hmask; i >= 0; i--) {
+                       hlist_for_each_entry_safe(policy, n, odst + i, bydst)
+                               hlist_del_rcu(&policy->bydst);
+               }
                if ((dir & XFRM_POLICY_MASK) == XFRM_POLICY_OUT) {
                        /* dir out => dst = remote, src = local */
                        net->xfrm.policy_bydst[dir].dbits4 = rbits4;
@@ -1315,8 +1316,6 @@ static void xfrm_hash_rebuild(struct work_struct *work)
                chain = policy_hash_bysel(net, &policy->selector,
                                          policy->family, dir);
 
-               hlist_del_rcu(&policy->bydst);
-
                if (!chain) {
                        void *p = xfrm_policy_inexact_insert(policy, dir, 0);
 
@@ -3628,7 +3627,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
                }
                xfrm_nr = ti;
                if (npols > 1) {
-                       xfrm_tmpl_sort(stp, tpp, xfrm_nr, family, net);
+                       xfrm_tmpl_sort(stp, tpp, xfrm_nr, family);
                        tpp = stp;
                }