Skip to content

Commit

Permalink
xfrm: policy: use hlist rcu variants on insert
Browse files Browse the repository at this point in the history
bydst table/list lookups use rcu, so insertions must use rcu versions.

Fixes: a7c4424 ("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>
  • Loading branch information
Florian Westphal authored and Steffen Klassert committed Oct 11, 2018
1 parent 9f7e43d commit 9dffff2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 9dffff2

Please sign in to comment.