aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2016-08-11 09:17:52 -0400
committerSteffen Klassert <steffen.klassert@secunet.com>2016-08-12 02:07:11 -0400
commita5eefc1df641f3c99fe54b309e7b79c18cec4a1e (patch)
tree5b0befb717a6f366b6445c3afd74380680460ded /net/xfrm
parentd737a5805581c6f99dad4caa9fdf80965d617d1a (diff)
xfrm: policy: use rcu versions for iteration and list add/del
This is required once we allow lockless readers. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_policy.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b5e665b3cfb0..93b8ff74001f 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -426,14 +426,14 @@ redo:
426 h = __addr_hash(&pol->selector.daddr, &pol->selector.saddr, 426 h = __addr_hash(&pol->selector.daddr, &pol->selector.saddr,
427 pol->family, nhashmask, dbits, sbits); 427 pol->family, nhashmask, dbits, sbits);
428 if (!entry0) { 428 if (!entry0) {
429 hlist_del(&pol->bydst); 429 hlist_del_rcu(&pol->bydst);
430 hlist_add_head(&pol->bydst, ndsttable+h); 430 hlist_add_head_rcu(&pol->bydst, ndsttable + h);
431 h0 = h; 431 h0 = h;
432 } else { 432 } else {
433 if (h != h0) 433 if (h != h0)
434 continue; 434 continue;
435 hlist_del(&pol->bydst); 435 hlist_del_rcu(&pol->bydst);
436 hlist_add_behind(&pol->bydst, entry0); 436 hlist_add_behind_rcu(&pol->bydst, entry0);
437 } 437 }
438 entry0 = &pol->bydst; 438 entry0 = &pol->bydst;
439 } 439 }
@@ -1106,7 +1106,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
1106 read_lock_bh(&net->xfrm.xfrm_policy_lock); 1106 read_lock_bh(&net->xfrm.xfrm_policy_lock);
1107 chain = policy_hash_direct(net, daddr, saddr, family, dir); 1107 chain = policy_hash_direct(net, daddr, saddr, family, dir);
1108 ret = NULL; 1108 ret = NULL;
1109 hlist_for_each_entry(pol, chain, bydst) { 1109 hlist_for_each_entry_rcu(pol, chain, bydst) {
1110 err = xfrm_policy_match(pol, fl, type, family, dir); 1110 err = xfrm_policy_match(pol, fl, type, family, dir);
1111 if (err) { 1111 if (err) {
1112 if (err == -ESRCH) 1112 if (err == -ESRCH)
@@ -1122,7 +1122,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
1122 } 1122 }
1123 } 1123 }
1124 chain = &net->xfrm.policy_inexact[dir]; 1124 chain = &net->xfrm.policy_inexact[dir];
1125 hlist_for_each_entry(pol, chain, bydst) { 1125 hlist_for_each_entry_rcu(pol, chain, bydst) {
1126 if ((pol->priority >= priority) && ret) 1126 if ((pol->priority >= priority) && ret)
1127 break; 1127 break;
1128 1128
@@ -1271,7 +1271,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
1271 1271
1272 /* Socket policies are not hashed. */ 1272 /* Socket policies are not hashed. */
1273 if (!hlist_unhashed(&pol->bydst)) { 1273 if (!hlist_unhashed(&pol->bydst)) {
1274 hlist_del(&pol->bydst); 1274 hlist_del_rcu(&pol->bydst);
1275 hlist_del(&pol->byidx); 1275 hlist_del(&pol->byidx);
1276 } 1276 }
1277 1277