summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2016-06-06 16:23:02 +0000
committerbz <bz@FreeBSD.org>2016-06-06 16:23:02 +0000
commit08c2ef1fa5c0462c63a899b9a8619fed09eed71c (patch)
treef75e2f2bd9c72604a6e85da401fbcf6844ce5670 /sys/net
parentc7d8c5362d057595b90514d7e09302c56d6891cb (diff)
downloadFreeBSD-src-08c2ef1fa5c0462c63a899b9a8619fed09eed71c.zip
FreeBSD-src-08c2ef1fa5c0462c63a899b9a8619fed09eed71c.tar.gz
Similarly to r301505 protect the removal of the ifa from the if_addrhead
by a lock (as well as the check that the list is not empty). Obtained from: projects/vnet MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index bd505e2..a9f2baf 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1007,11 +1007,14 @@ if_detach_internal(struct ifnet *ifp, int vmove, struct if_clone **ifcp)
ifp->if_addr = NULL;
/* We can now free link ifaddr. */
+ IF_ADDR_WLOCK(ifp);
if (!TAILQ_EMPTY(&ifp->if_addrhead)) {
ifa = TAILQ_FIRST(&ifp->if_addrhead);
TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
+ IF_ADDR_WUNLOCK(ifp);
ifa_free(ifa);
- }
+ } else
+ IF_ADDR_WUNLOCK(ifp);
}
rt_flushifroutes(ifp);
OpenPOWER on IntegriCloud