netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [IPSEC] Lock policy in policy timer
@ 2004-05-22 12:16 Herbert Xu
  2004-05-22 20:34 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2004-05-22 12:16 UTC (permalink / raw)
  To: David S. Miller, netdev

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

Hi Dave:

In light of the xfrm_state timer bug, I reviewed the policy timer as
well.  In doing so I found that the policy timer didn't take a lock
on the policy.

Although this won't lead to a panic, it does mean that a policy might
potentially take a long time to be freed.

So here is a patch to take a read_lock on the policy in the timer
so that it does not die on us.  Since the timer doesn't occur very
often, this shouldn't have much of an impact.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 366 bytes --]

===== xfrm_policy.c 1.49 vs edited =====
--- 1.49/net/xfrm/xfrm_policy.c	2004-03-20 14:35:32 +11:00
+++ edited/xfrm_policy.c	2004-05-22 22:11:51 +10:00
@@ -148,6 +148,8 @@
 	int warn = 0;
 	int dir;
 
+	read_lock(&xp->lock);
+
 	if (xp->dead)
 		goto out;
 
@@ -197,6 +199,7 @@
 		xfrm_pol_hold(xp);
 
 out:
+	read_unlock(&xp->lock);
 	xfrm_pol_put(xp);
 	return;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [IPSEC] Lock policy in policy timer
  2004-05-22 12:16 [IPSEC] Lock policy in policy timer Herbert Xu
@ 2004-05-22 20:34 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-05-22 20:34 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev


Looks fine, applied.

Thanks Herbert.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-22 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-22 12:16 [IPSEC] Lock policy in policy timer Herbert Xu
2004-05-22 20:34 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).