svn commit: r341086 - stable/12/sys/netinet6
Eric van Gyzen
vangyzen at FreeBSD.org
Tue Nov 27 19:40:08 UTC 2018
Author: vangyzen
Date: Tue Nov 27 19:40:07 2018
New Revision: 341086
URL: https://svnweb.freebsd.org/changeset/base/341086
Log:
MFC r340257
in6_ifattach_linklocal: handle immediate removal of the new LLA
If another thread immediately removes the link-local address
added by in6_update_ifa(), in6ifa_ifpforlinklocal() can return NULL,
so the following assertion (or dereference) is wrong.
Remove the assertion, and handle NULL somewhat better than panicking.
This matches all of the other callers of in6_update_ifa().
PR: 219250
Reviewed by: bz, dab (both an earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D17898
Modified:
stable/12/sys/netinet6/in6_ifattach.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/netinet6/in6_ifattach.c
==============================================================================
--- stable/12/sys/netinet6/in6_ifattach.c Tue Nov 27 17:58:25 2018 (r341085)
+++ stable/12/sys/netinet6/in6_ifattach.c Tue Nov 27 19:40:07 2018 (r341086)
@@ -481,9 +481,16 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet
return (-1);
}
- ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */
- KASSERT(ia != NULL, ("%s: ia == NULL, ifp=%p", __func__, ifp));
-
+ ia = in6ifa_ifpforlinklocal(ifp, 0);
+ if (ia == NULL) {
+ /*
+ * Another thread removed the address that we just added.
+ * This should be rare, but it happens.
+ */
+ nd6log((LOG_NOTICE, "%s: %s: new link-local address "
+ "disappeared\n", __func__, if_name(ifp)));
+ return (-1);
+ }
ifa_free(&ia->ia_ifa);
/*
More information about the svn-src-all
mailing list