Skip to content

Commit 2e460ee

Browse files
Florian Westphalklassert
authored andcommitted
xfrm: state: make xfrm_state_lookup_byaddr lockless
This appears to be an oversight back when the state lookup was converted to RCU, I see no reason why we need to hold the state lock here. __xfrm_state_lookup_byaddr already uses xfrm_state_hold_rcu helper to obtain a reference, so just replace the state lock with rcu. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 9d381c7 commit 2e460ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/xfrm/xfrm_state.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,12 +2313,12 @@ xfrm_state_lookup_byaddr(struct net *net, u32 mark,
23132313
struct xfrm_hash_state_ptrs state_ptrs;
23142314
struct xfrm_state *x;
23152315

2316-
spin_lock_bh(&net->xfrm.xfrm_state_lock);
2316+
rcu_read_lock();
23172317

23182318
xfrm_hash_ptrs_get(net, &state_ptrs);
23192319

23202320
x = __xfrm_state_lookup_byaddr(&state_ptrs, mark, daddr, saddr, proto, family);
2321-
spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2321+
rcu_read_unlock();
23222322
return x;
23232323
}
23242324
EXPORT_SYMBOL(xfrm_state_lookup_byaddr);

0 commit comments

Comments
 (0)