]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
xfrm: policy: use hlist rcu variants on insert
authorFlorian Westphal <fw@strlen.de>
Wed, 10 Oct 2018 16:02:21 +0000 (18:02 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Thu, 11 Oct 2018 11:24:46 +0000 (13:24 +0200)
bydst table/list lookups use rcu, so insertions must use rcu versions.

Fixes: a7c44247f704e ("xfrm: policy: make xfrm_policy_lookup_bytype lockless")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_policy.c

index f094d4b3520d97773b87baf5700df79fc8ca4666..119a427d9b2b2dde15422c2d236e1c1684cba6e5 100644 (file)
@@ -632,9 +632,9 @@ static void xfrm_hash_rebuild(struct work_struct *work)
                                break;
                }
                if (newpos)
-                       hlist_add_behind(&policy->bydst, newpos);
+                       hlist_add_behind_rcu(&policy->bydst, newpos);
                else
-                       hlist_add_head(&policy->bydst, chain);
+                       hlist_add_head_rcu(&policy->bydst, chain);
        }
 
        spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
@@ -774,9 +774,9 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
                        break;
        }
        if (newpos)
-               hlist_add_behind(&policy->bydst, newpos);
+               hlist_add_behind_rcu(&policy->bydst, newpos);
        else
-               hlist_add_head(&policy->bydst, chain);
+               hlist_add_head_rcu(&policy->bydst, chain);
        __xfrm_policy_link(policy, dir);
 
        /* After previous checking, family can either be AF_INET or AF_INET6 */