Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740667 > unrolled thread

[PATCH] xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock

Started byArtem Savkov <asavkov@redhat.com>
First post2017-09-27 14:30 +0200
Last post2017-09-28 13:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock Artem Savkov <asavkov@redhat.com> - 2017-09-27 14:30 +0200
    Re: [PATCH] xfrm: don't call xfrm_policy_cache_flush under  xfrm_state_lock Florian Westphal <fw@strlen.de> - 2017-09-27 14:40 +0200
      Re: [PATCH] xfrm: don't call xfrm_policy_cache_flush under  xfrm_state_lock Steffen Klassert <steffen.klassert@secunet.com> - 2017-09-28 13:20 +0200

#1740667 — [PATCH] xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock

FromArtem Savkov <asavkov@redhat.com>
Date2017-09-27 14:30 +0200
Subject[PATCH] xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock
Message-ID<uujDs-2nV-9@gated-at.bofh.it>
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>
---
 net/xfrm/xfrm_state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 0dab1cd79ce4..12213477cd3a 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -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);
-- 
2.13.5

[toc] | [next] | [standalone]


#1740674 — Re: [PATCH] xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock

FromFlorian Westphal <fw@strlen.de>
Date2017-09-27 14:40 +0200
SubjectRe: [PATCH] xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock
Message-ID<uujN7-2tn-7@gated-at.bofh.it>
In reply to#1740667
Artem Savkov <asavkov@redhat.com> wrote:
> 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>

You're right, its not needed (and wrong).

Acked-by: Florian Westphal <fw@strlen.de>

[toc] | [prev] | [next] | [standalone]


#1741453 — Re: [PATCH] xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock

FromSteffen Klassert <steffen.klassert@secunet.com>
Date2017-09-28 13:20 +0200
SubjectRe: [PATCH] xfrm: don't call xfrm_policy_cache_flush under xfrm_state_lock
Message-ID<uuF1f-8jv-1@gated-at.bofh.it>
In reply to#1740674
On Wed, Sep 27, 2017 at 02:31:03PM +0200, Florian Westphal wrote:
> Artem Savkov <asavkov@redhat.com> wrote:
> > 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>
> 
> You're right, its not needed (and wrong).
> 
> Acked-by: Florian Westphal <fw@strlen.de>

Applied to the ipsec tree, thanks everyone!

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web