svn commit: r216359 - stable/8/sys/netinet6

Bjoern A. Zeeb bz at FreeBSD.org
Fri Dec 10 15:37:55 UTC 2010


Author: bz
Date: Fri Dec 10 15:37:54 2010
New Revision: 216359
URL: http://svn.freebsd.org/changeset/base/216359

Log:
  MFC r216277:
  
    Loosen the locking in nd6-free() again after r216022 (r216118 in stable/8)
    to avoid a LOR and a recursed lock.
  
    Reported by:	delphij
    Tested by:	delphij
  PR:		kern/148857
  Approved by:	re (kib)

Modified:
  stable/8/sys/netinet6/nd6.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/netinet6/nd6.c
==============================================================================
--- stable/8/sys/netinet6/nd6.c	Fri Dec 10 15:05:49 2010	(r216358)
+++ stable/8/sys/netinet6/nd6.c	Fri Dec 10 15:37:54 2010	(r216359)
@@ -1049,15 +1049,6 @@ nd6_free(struct llentry *ln, int gc)
 			return (next);
 		}
 
-		if (ln->ln_router || dr) {
-			/*
-			 * rt6_flush must be called whether or not the neighbor
-			 * is in the Default Router List.
-			 * See a corresponding comment in nd6_na_input().
-			 */
-			rt6_flush(&L3_ADDR_SIN6(ln)->sin6_addr, ifp);
-		}
-
 		if (dr) {
 			/*
 			 * Unreachablity of a router might affect the default
@@ -1073,8 +1064,28 @@ nd6_free(struct llentry *ln, int gc)
 			 * or the entry itself will be deleted.
 			 */
 			ln->ln_state = ND6_LLINFO_INCOMPLETE;
+		}
+
+		if (ln->ln_router || dr) {
 
 			/*
+			 * We need to unlock to avoid a LOR with rt6_flush() with the
+			 * rnh and for the calls to pfxlist_onlink_check() and
+			 * defrouter_select() in the block further down for calls
+			 * into nd6_lookup().  We still hold a ref.
+			 */
+			LLE_WUNLOCK(ln);
+
+			/*
+			 * rt6_flush must be called whether or not the neighbor
+			 * is in the Default Router List.
+			 * See a corresponding comment in nd6_na_input().
+			 */
+			rt6_flush(&L3_ADDR_SIN6(ln)->sin6_addr, ifp);
+		}
+
+		if (dr) {
+			/*
 			 * Since defrouter_select() does not affect the
 			 * on-link determination and MIP6 needs the check
 			 * before the default router selection, we perform
@@ -1083,13 +1094,13 @@ nd6_free(struct llentry *ln, int gc)
 			pfxlist_onlink_check();
 
 			/*
-			 * Refresh default router list.  Have to unlock as
-			 * it calls into nd6_lookup(), still holding a ref.
+			 * Refresh default router list.
 			 */
-			LLE_WUNLOCK(ln);
 			defrouter_select();
-			LLE_WLOCK(ln);
 		}
+
+		if (ln->ln_router || dr)
+			LLE_WLOCK(ln);
 	}
 
 	/*


More information about the svn-src-all mailing list