From owner-svn-src-all@freebsd.org Mon May 21 13:08:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEC8DEF0938; Mon, 21 May 2018 13:08:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8BDD97D337; Mon, 21 May 2018 13:08:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52453253F0; Mon, 21 May 2018 13:08:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4LD8jOT061277; Mon, 21 May 2018 13:08:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4LD8jQT061276; Mon, 21 May 2018 13:08:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805211308.w4LD8jQT061276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 21 May 2018 13:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333978 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 333978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 13:08:46 -0000 Author: emaste Date: Mon May 21 13:08:44 2018 New Revision: 333978 URL: https://svnweb.freebsd.org/changeset/base/333978 Log: Pair CURVNET_SET and CURVNET_RESTORE in a block Per vnet(9), CURVNET_SET and CURVNET_RESTORE cannot be used as a single statement for a conditional and CURVNET_RESTORE must be in the same block as CURVNET_SET (or a subblock). Reviewed by: andrew Sponsored by: The FreeBSD Foundation Modified: head/sys/netinet/in_mcast.c head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Mon May 21 13:08:18 2018 (r333977) +++ head/sys/netinet/in_mcast.c Mon May 21 13:08:44 2018 (r333978) @@ -663,15 +663,17 @@ inm_release(struct in_multi *inm) /* XXX this access is not covered by IF_ADDR_LOCK */ CTR2(KTR_IGMPV3, "%s: purging ifma %p", __func__, ifma); - if (ifp) + if (ifp != NULL) { CURVNET_SET(ifp->if_vnet); - inm_purge(inm); - free(inm, M_IPMADDR); - - if_delmulti_ifma_flags(ifma, 1); - if (ifp) { + inm_purge(inm); + free(inm, M_IPMADDR); + if_delmulti_ifma_flags(ifma, 1); CURVNET_RESTORE(); if_rele(ifp); + } else { + inm_purge(inm); + free(inm, M_IPMADDR); + if_delmulti_ifma_flags(ifma, 1); } } @@ -1677,11 +1679,13 @@ inp_gcmoptions(epoch_context_t ctx) imf_leave(imf); inm = imo->imo_membership[idx]; ifp = inm->inm_ifp; - if (ifp) + if (ifp != NULL) { CURVNET_SET(ifp->if_vnet); - (void)in_leavegroup(inm, imf); - if (ifp) + (void)in_leavegroup(inm, imf); CURVNET_RESTORE(); + } else { + (void)in_leavegroup(inm, imf); + } if (imf) imf_purge(imf); } Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Mon May 21 13:08:18 2018 (r333977) +++ head/sys/netinet6/in6_mcast.c Mon May 21 13:08:44 2018 (r333978) @@ -539,15 +539,17 @@ in6m_release(struct in6_multi *inm) KASSERT(ifma->ifma_protospec == NULL, ("%s: ifma_protospec != NULL", __func__)); - if (ifp) + if (ifp != NULL) { CURVNET_SET(ifp->if_vnet); - in6m_purge(inm); - free(inm, M_IP6MADDR); - - if_delmulti_ifma_flags(ifma, 1); - if (ifp) { + in6m_purge(inm); + free(inm, M_IP6MADDR); + if_delmulti_ifma_flags(ifma, 1); CURVNET_RESTORE(); if_rele(ifp); + } else { + in6m_purge(inm); + free(inm, M_IP6MADDR); + if_delmulti_ifma_flags(ifma, 1); } } @@ -1639,11 +1641,13 @@ inp_gcmoptions(epoch_context_t ctx) im6f_leave(imf); inm = imo->im6o_membership[idx]; ifp = inm->in6m_ifp; - if (ifp) + if (ifp != NULL) { CURVNET_SET(ifp->if_vnet); - (void)in6_leavegroup(inm, imf); - if (ifp) + (void)in6_leavegroup(inm, imf); CURVNET_RESTORE(); + } else { + (void)in6_leavegroup(inm, imf); + } if (imf) im6f_purge(imf); }