]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock
authorArtem Savkov <asavkov@redhat.com>
Wed, 27 Sep 2017 12:25:37 +0000 (14:25 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Thu, 28 Sep 2017 07:39:05 +0000 (09:39 +0200)
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.

Fixes: ec30d78c14a8 xfrm: add xdst pcpu cache
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_state.c

index 0dab1cd79ce4d1afe84ba9422a740689a9ebdf71..12213477cd3ad90af9dc2e1bed236e461621115b 100644 (file)
@@ -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);