Skip to content

Commit a7c4424

Browse files
Florian Westphalklassert
authored andcommitted
xfrm: policy: make xfrm_policy_lookup_bytype lockless
side effect: no longer disables BH (should be fine). Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent e37cc8a commit a7c4424

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/net/netns/xfrm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
struct ctl_table_header;
1212

1313
struct xfrm_policy_hash {
14-
struct hlist_head *table;
14+
struct hlist_head __rcu *table;
1515
unsigned int hmask;
1616
u8 dbits4;
1717
u8 sbits4;

net/xfrm/xfrm_policy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
11231123
if (unlikely(!daddr || !saddr))
11241124
return NULL;
11251125

1126-
read_lock_bh(&net->xfrm.xfrm_policy_lock);
1126+
rcu_read_lock();
11271127
retry:
11281128
do {
11291129
sequence = read_seqcount_begin(&xfrm_policy_hash_generation);
@@ -1172,7 +1172,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
11721172
if (ret && !xfrm_pol_hold_rcu(ret))
11731173
goto retry;
11741174
fail:
1175-
read_unlock_bh(&net->xfrm.xfrm_policy_lock);
1175+
rcu_read_unlock();
11761176

11771177
return ret;
11781178
}

0 commit comments

Comments
 (0)