diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c index bfc5e3b3869a..7d2d2bf03070 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -2211,7 +2211,11 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt) __func__); goto out_inp_locked; } - inm_acquire(imf->imf_inm); + /* + * NOTE: Refcount from in_joingroup_locked() + * is protecting membership. + */ + ip_mfilter_insert(&imo->imo_head, imf); } else { CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); IN_MULTI_LIST_LOCK(); @@ -2235,8 +2239,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt) goto out_inp_locked; } } - if (is_new) - ip_mfilter_insert(&imo->imo_head, imf); imf_commit(imf); imf = NULL; diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index ec33273144db..a5ef1e96d787 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -2111,6 +2111,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) * NOTE: Refcount from in6_joingroup_locked() * is protecting membership. */ + ip6_mfilter_insert(&imo->im6o_head, imf); } else { CTR1(KTR_MLD, "%s: merge inm state", __func__); IN6_MULTI_LIST_LOCK(); @@ -2136,9 +2137,6 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) } } - if (is_new) - ip6_mfilter_insert(&imo->im6o_head, imf); - im6f_commit(imf); imf = NULL;