Skip to contentSkip to conversation

xfrm: policy: use hlist rcu variants on insert

PATCH Applied Florian Westphal 2 participants 2 messages Oct 10, 2018 – Oct 12, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfrm: policy: use hlist rcu variants on insert

bydst table/list lookups use rcu, so insertions must use rcu versions.

Fixes a7c44247f704e ("xfrm: policy: make xfrm_policy_lookup_bytype lockless")
---
 net/xfrm/xfrm_policy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/xfrm/xfrm_policy.c +4 -4
index 3110c3fbee20..3cf1fd7c0869 100644
@@ -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 */
Signature · 1 line
2.18.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Florian Westphal

bydst table/list lookups use rcu, so insertions must use rcu versions.

Fixes a7c44247f704e ("xfrm: policy: make xfrm_policy_lookup_bytype lockless")

Applied, thanks Florian!