Date: Wed, 12 Aug 2020 16:16:18 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364169 - stable/12/sys/netinet Message-ID: <202008121616.07CGGIoU084006@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Aug 12 16:16:17 2020 New Revision: 364169 URL: https://svnweb.freebsd.org/changeset/base/364169 Log: MFC r356321 (by markj): Take the ifnet's address lock in igmp_v3_cancel_link_timers(). inm_rele_locked() may remove the multicast address associated with inm. Modified: stable/12/sys/netinet/igmp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/igmp.c ============================================================================== --- stable/12/sys/netinet/igmp.c Wed Aug 12 16:08:44 2020 (r364168) +++ stable/12/sys/netinet/igmp.c Wed Aug 12 16:16:17 2020 (r364169) @@ -1986,7 +1986,7 @@ igmp_set_version(struct igmp_ifsoftc *igi, const int v static void igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) { - struct ifmultiaddr *ifma; + struct ifmultiaddr *ifma, *ifmatmp; struct ifnet *ifp; struct in_multi *inm; struct in_multi_head inm_free_tmp; @@ -2010,8 +2010,8 @@ igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) * for all memberships scoped to this link. */ ifp = igi->igi_ifp; - IF_ADDR_RLOCK(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + IF_ADDR_WLOCK(ifp); + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, ifmatmp) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -2055,7 +2055,7 @@ igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) inm->inm_timer = 0; mbufq_drain(&inm->inm_scq); } - IF_ADDR_RUNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); inm_release_list_deferred(&inm_free_tmp); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008121616.07CGGIoU084006>