[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1KakUR-0001xp-00@gondolin.me.apana.org.au>
Date: Wed, 03 Sep 2008 15:01:11 +1000
From: Herbert Xu <herbert@...dor.apana.org.au>
To: davem@...emloft.net (David Miller)
Cc: netdev@...r.kernel.org, timo.teras@....fi
Subject: Re: xfrm_state locking regression...
David Miller <davem@...emloft.net> wrote:
>
> This is what added the xfrm_state_lock grabbing in __xfrm_state_destroy().
This is simply bogus. We should remove the entry from the list
when the state is deleted, not when it's destroyed. That is, we
should be deleting x->all in places like __xfrm_state_delete instead
of __xfrm_state_destroy.
The fact that we're adding x->all in __xfrm_state_insert means
that we should be deleting it from its counter-part, which is
__xfrm_state_delete.
The same thing applies to the policies of course. Once a policy
or state is deleted there is no reason why it should show up in a
walk just because some dst is holding onto it.
> ipsec: Fix deadlock in xfrm_state management.
>
> Ever since commit 4c563f7669c10a12354b72b518c2287ffc6ebfb3
> ("[XFRM]: Speed up xfrm_policy and xfrm_state walking") it is
> illegal to call __xfrm_state_destroy (and thus xfrm_state_put())
> with xfrm_state_lock held. If we do, we'll deadlock since we
> have the lock already and __xfrm_state_destroy() tries to take
> it again.
>
> Fix this by pushing the xfrm_state_put() calls after the lock
> is dropped.
>
> Signed-off-by: David S. Miller <davem@...emloft.net>
However, moving things out of critical sections is always a good
idea. So I think your patch is an improvement regardless of why
it came about :)
Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists