xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock
Subsystems (3)
PATCH 1/1 xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock
I might be wrong but it doesn't look like xfrm_state_lock is required for xfrm_policy_cache_flush and calling it under this lock triggers both "sleeping function called from invalid context" and "possible circular locking dependency detected" warnings on flush.
--- net/xfrm/xfrm_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/xfrm/xfrm_state.c +2 -2
@@ -732,12 +732,12 @@ int xfrm_state_flush(struct net *net, u8 proto, bool task_valid) } } } +out: +spin_unlock_bh (&net->xfrm.xfrm_state_lock);if (cnt) { err =0 ;xfrm_policy_cache_flush (); } -out: -spin_unlock_bh (&net->xfrm.xfrm_state_lock);return err; }EXPORT_SYMBOL (xfrm_state_flush);
Signature · 1 line
2.13.5
Quoted 7 lines · Artem Savkov
I might be wrong but it doesn't look like
xfrm_state_lockis required forxfrm_policy_cache_flushand calling it under this lock triggers both "sleeping function called from invalid context" and "possible circular locking dependency detected" warnings on flush.Fixes ec30d78c14a8 xfrm: add xdst pcpu cacheSigned-off-by Artem Savkov <[email protected]>
You're right, its not needed (and wrong).
Quoted 6 lines · Florian Westphal
Quoted 5 lines · Artem Savkov
I might be wrong but it doesn't look like
xfrm_state_lockis required forxfrm_policy_cache_flushand calling it under this lock triggers both "sleeping function called from invalid context" and "possible circular locking dependency detected" warnings on flush.
Quoted 6 lines
Quoted 2 lines
Fixes ec30d78c14a8 xfrm: add xdst pcpu cacheSigned-off-by Artem Savkov <[email protected]>You're right, its not needed (and wrong).
Acked-by Florian Westphal <[email protected]>
Applied to the ipsec tree, thanks everyone!