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
This commit is contained in:
parent
25cd3a2011
commit
28309d8186
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user