tree 3db1367cfcf4884170ac0b7205d155c807c6bc72
parent c400bd375a40031c981ad6fe7e8857b213fe8283
author Herbert Xu <[EMAIL PROTECTED]> Tue Apr 12 08:24:46 2005
committer Linus Torvalds <[EMAIL PROTECTED]> Tue Apr 12 08:24:46 2005
[PATCH] Fix dst_destroy() race
When we are not the real parent of the dst (e.g., when we're xfrm_dst and
the child is an rtentry), it may already be on the GC list.
In fact the current code is buggy to, we need to check dst->flags before
the dec as dst may no longer be valid afterwards.
Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
dst.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
Index: net/core/dst.c
===================================================================
--- 45eaecaad3831ecb12a7230c37545ff40e7ec82c/net/core/dst.c (mode:100644
sha1:0a0eb6102c5d07f5b8d3897970fb0218c7b1fd3a)
+++ 3db1367cfcf4884170ac0b7205d155c807c6bc72/net/core/dst.c (mode:100644
sha1:b2fb2520e2024cd95f8466d6b3dfd2889ea40b64)
@@ -198,13 +198,15 @@
dst = child;
if (dst) {
+ int nohash = dst->flags & DST_NOHASH;
+
if (atomic_dec_and_test(&dst->__refcnt)) {
/* We were real parent of this dst, so kill child. */
- if (dst->flags&DST_NOHASH)
+ if (nohash)
goto again;
} else {
/* Child is still referenced, return it for freeing. */
- if (dst->flags&DST_NOHASH)
+ if (nohash)
return dst;
/* Child is still in his hash table */
}
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html