From owner-dev-commits-src-branches@freebsd.org Tue Sep 7 21:13:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 5C23F66C8B9; Tue, 7 Sep 2021 21:13:00 +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 4H3yfN1lRKz4VpH; Tue, 7 Sep 2021 21:13:00 +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 D0A981994C; Tue, 7 Sep 2021 21:12:55 +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 187LCtvE024081; Tue, 7 Sep 2021 21:12:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCtmw024080; Tue, 7 Sep 2021 21:12:55 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:55 GMT Message-Id: <202109072112.187LCtmw024080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 4e97cbba1c79 - stable/13 - lltable: fix crash introduced in c541bd368f86. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e97cbba1c79fc7c2a5ceeccefbea0f71887e915 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:13:00 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4e97cbba1c79fc7c2a5ceeccefbea0f71887e915 commit 4e97cbba1c79fc7c2a5ceeccefbea0f71887e915 Author: Alexander V. Chernikov AuthorDate: 2021-08-22 08:47:49 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 lltable: fix crash introduced in c541bd368f86. Reported by: cy (cherry picked from commit f8c1b1a9296696f70ac209612a00ae0722d07ed9) --- sys/netinet6/in6.c | 7 ++++--- sys/netinet6/nd6_rtr.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 142a05ded2b6..d54aba58edb6 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2323,6 +2323,7 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) { const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)l3addr; + int family = flags >> 16; struct llentry *lle; IF_AFDATA_LOCK_ASSERT(llt->llt_ifp); @@ -2333,13 +2334,13 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, ("wrong lle request flags: %#x", flags)); lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); - if (lle == NULL) - return (NULL); - int family = flags >> 16; if (__predict_false(family != AF_INET6)) lle = llentry_lookup_family(lle, family); + if (lle == NULL) + return (NULL); + if (flags & LLE_UNLOCKED) return (lle); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 2960b6cad951..cec9fccd63c4 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -972,7 +972,7 @@ defrouter_select_fib(int fibnum) TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { NET_EPOCH_ENTER(et); if (selected_dr == NULL && dr->ifp->if_fib == fibnum && - (ln = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) && + (ln = nd6_lookup(&dr->rtaddr, LLE_SF(AF_INET6, 0), dr->ifp)) && ND6_IS_LLINFO_PROBREACH(ln)) { selected_dr = dr; defrouter_ref(selected_dr); @@ -1814,7 +1814,8 @@ find_pfxlist_reachable_router(struct nd_prefix *pr) NET_EPOCH_ENTER(et); LIST_FOREACH(pfxrtr, &pr->ndpr_advrtrs, pfr_entry) { - ln = nd6_lookup(&pfxrtr->router->rtaddr, 0, pfxrtr->router->ifp); + ln = nd6_lookup(&pfxrtr->router->rtaddr, LLE_SF(AF_INET6, 0), + pfxrtr->router->ifp); if (ln == NULL) continue; canreach = ND6_IS_LLINFO_PROBREACH(ln);