From owner-svn-src-head@freebsd.org Thu May 10 16:19:42 2018 Return-Path: Delivered-To: svn-src-head@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 607BEFCF067; Thu, 10 May 2018 16:19:42 +0000 (UTC) (envelope-from gallatin@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 08FA17FA3A; Thu, 10 May 2018 16:19:42 +0000 (UTC) (envelope-from gallatin@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 D4CD922B92; Thu, 10 May 2018 16:19:41 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4AGJfic077983; Thu, 10 May 2018 16:19:41 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4AGJf78077982; Thu, 10 May 2018 16:19:41 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201805101619.w4AGJf78077982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Thu, 10 May 2018 16:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333462 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 333462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2018 16:19:42 -0000 Author: gallatin Date: Thu May 10 16:19:41 2018 New Revision: 333462 URL: https://svnweb.freebsd.org/changeset/base/333462 Log: Fix a panic in the IPv6 multicast code. Use LIST_FOREACH_SAFE in in6m_disconnect() since we're deleting and freeing item from the membership list while traversing the list. Reviewed by: mmacy Sponsored by: Netflix Modified: head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Thu May 10 15:01:43 2018 (r333461) +++ head/sys/netinet6/in6_mcast.c Thu May 10 16:19:41 2018 (r333462) @@ -581,7 +581,7 @@ in6m_disconnect(struct in6_multi *inm) struct ifnet *ifp; struct ifaddr *ifa; struct in6_ifaddr *ifa6; - struct in6_multi_mship *imm; + struct in6_multi_mship *imm, *imm_tmp; struct ifmultiaddr *ifma, *ll_ifma; ifp = inm->in6m_ifp; @@ -607,7 +607,8 @@ in6m_disconnect(struct in6_multi *inm) if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (void *)ifa; - LIST_FOREACH(imm, &ifa6->ia6_memberships, i6mm_chain) { + LIST_FOREACH_SAFE(imm, &ifa6->ia6_memberships, + i6mm_chain, imm_tmp) { if (inm == imm->i6mm_maddr) { LIST_REMOVE(imm, i6mm_chain); free(imm, M_IP6MADDR);