Date: Thu, 8 Nov 2018 19:50:23 +0000 (UTC) From: Eric van Gyzen <vangyzen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340257 - head/sys/netinet6 Message-ID: <201811081950.wA8JoN1q023583@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vangyzen Date: Thu Nov 8 19:50:23 2018 New Revision: 340257 URL: https://svnweb.freebsd.org/changeset/base/340257 Log: 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) MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D17898 Modified: head/sys/netinet6/in6_ifattach.c Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Thu Nov 8 19:10:43 2018 (r340256) +++ head/sys/netinet6/in6_ifattach.c Thu Nov 8 19:50:23 2018 (r340257) @@ -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); /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811081950.wA8JoN1q023583>