Author: bz Date: Mon Jun 6 13:17:25 2016 New Revision: 301505 URL: https://svnweb.freebsd.org/changeset/base/301505
Log: In if_purgeaddrs() we cannot hold the lock over the entire loop due to called functions (as in other parts of the stack, leave a comment). Put around a lock the removal of the ifa from the list however to reduce the possible race with other places. Obtained from: projects/vnet MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Jun 6 13:04:22 2016 (r301504) +++ head/sys/net/if.c Mon Jun 6 13:17:25 2016 (r301505) @@ -848,6 +848,7 @@ if_purgeaddrs(struct ifnet *ifp) { struct ifaddr *ifa, *next; + /* XXX cannot hold IF_ADDR_WLOCK over called functions. */ TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { if (ifa->ifa_addr->sa_family == AF_LINK) continue; @@ -872,7 +873,9 @@ if_purgeaddrs(struct ifnet *ifp) continue; } #endif /* INET6 */ + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); + IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); } } _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"