From owner-dev-commits-src-all@freebsd.org Tue Mar 2 15:17:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6135756C7A5; Tue, 2 Mar 2021 15:17:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dqgjn6CH3z4Wh7; Tue, 2 Mar 2021 15:17:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93AB618C46; Tue, 2 Mar 2021 15:17:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 122FHnXX039552; Tue, 2 Mar 2021 15:17:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHn9S039550; Tue, 2 Mar 2021 15:17:49 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:49 GMT Message-Id: <202103021517.122FHn9S039550@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a285c84d517f - stable/12 - arp/nd: Cope with late calls to iflladdr_event MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a285c84d517f4b987dfbbcec876d1fd812065a27 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2021 15:17:56 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a285c84d517f4b987dfbbcec876d1fd812065a27 commit a285c84d517f4b987dfbbcec876d1fd812065a27 Author: Kristof Provost AuthorDate: 2021-02-22 07:19:43 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 08:31:13 +0000 arp/nd: Cope with late calls to iflladdr_event When tearing down vnet jails we can move an if_bridge out (as part of the normal vnet_if_return()). This can, when it's clearing out its list of member interfaces, change its link layer address. That sends an iflladdr_event, but at that point we've already freed the AF_INET/AF_INET6 if_afdata pointers. In other words: when the iflladdr_event callbacks fire we can't assume that ifp->if_afdata[AF_INET] will be set. Reviewed by: donner@, melifaro@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28860 (cherry picked from commit c139b3c19b52abe3b5ba23a8175e58e70c7a528d) --- sys/netinet/if_ether.c | 4 ++++ sys/netinet6/nd6.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index a05001999ca4..538f6abb9855 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1461,6 +1461,10 @@ arp_handle_ifllchange(struct ifnet *ifp) static void arp_iflladdr(void *arg __unused, struct ifnet *ifp) { + /* if_bridge can update its lladdr during if_vmove(), after we've done + * if_detach_internal()/dom_ifdetach(). */ + if (ifp->if_afdata[AF_INET] == NULL) + return; lltable_update_ifaddr(LLTABLE(ifp)); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 50fcc3226f97..d1d4b7c7fa88 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -206,6 +206,8 @@ nd6_lle_event(void *arg __unused, struct llentry *lle, int evt) static void nd6_iflladdr(void *arg __unused, struct ifnet *ifp) { + if (ifp->if_afdata[AF_INET6] == NULL) + return; lltable_update_ifaddr(LLTABLE6(ifp)); }