svn commit: r339859 - stable/12/sys/net
Hans Petter Selasky
hselasky at FreeBSD.org
Mon Oct 29 13:17:42 UTC 2018
Author: hselasky
Date: Mon Oct 29 13:17:41 2018
New Revision: 339859
URL: https://svnweb.freebsd.org/changeset/base/339859
Log:
MFC r339588:
Resolve deadlock between epoch(9) and various network interface
SX-locks, during if_purgeaddrs(), by not allowing to hold the epoch
read lock over typical network IOCTL code paths. This is a regression
issue after r334305.
Reviewed by: ae (network)
Approved by: re (kib)
Differential revision: https://reviews.freebsd.org/D17647
Sponsored by: Mellanox Technologies
Modified:
stable/12/sys/net/if.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/net/if.c
==============================================================================
--- stable/12/sys/net/if.c Mon Oct 29 12:48:30 2018 (r339858)
+++ stable/12/sys/net/if.c Mon Oct 29 13:17:41 2018 (r339859)
@@ -964,12 +964,18 @@ if_attachdomain1(struct ifnet *ifp)
void
if_purgeaddrs(struct ifnet *ifp)
{
- struct ifaddr *ifa, *next;
+ struct ifaddr *ifa;
- NET_EPOCH_ENTER();
- CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) {
- if (ifa->ifa_addr->sa_family == AF_LINK)
- continue;
+ while (1) {
+ NET_EPOCH_ENTER();
+ CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+ if (ifa->ifa_addr->sa_family != AF_LINK)
+ break;
+ }
+ NET_EPOCH_EXIT();
+
+ if (ifa == NULL)
+ break;
#ifdef INET
/* XXX: Ugly!! ad hoc just for INET */
if (ifa->ifa_addr->sa_family == AF_INET) {
@@ -996,7 +1002,6 @@ if_purgeaddrs(struct ifnet *ifp)
IF_ADDR_WUNLOCK(ifp);
ifa_free(ifa);
}
- NET_EPOCH_EXIT();
}
/*
More information about the svn-src-stable
mailing list