Skip to content

Commit 40093a2

Browse files
Veaceslav Falicogregkh
authored andcommitted
igmp: call ip_mc_clear_src() only when we have no users of ip_mc_list
[ Upstream commit 24cf3af ] In igmp_group_dropped() we call ip_mc_clear_src(), which resets the number of source filters per mulitcast. However, igmp_group_dropped() is also called on NETDEV_DOWN, NETDEV_PRE_TYPE_CHANGE and NETDEV_UNREGISTER, which means that the group might get added back on NETDEV_UP, NETDEV_REGISTER and NETDEV_POST_TYPE_CHANGE respectively, leaving us with broken source filters. To fix that, we must clear the source filters only when there are no users in the ip_mc_list, i.e. in ip_mc_dec_group() and on device destroy. Acked-by: David L Stevens <dlstevens@us.ibm.com> Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent a0e3d9a commit 40093a2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

net/ipv4/igmp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,20 +1169,18 @@ static void igmp_group_dropped(struct ip_mc_list *im)
11691169

11701170
if (!in_dev->dead) {
11711171
if (IGMP_V1_SEEN(in_dev))
1172-
goto done;
1172+
return;
11731173
if (IGMP_V2_SEEN(in_dev)) {
11741174
if (reporter)
11751175
igmp_send_report(in_dev, im, IGMP_HOST_LEAVE_MESSAGE);
1176-
goto done;
1176+
return;
11771177
}
11781178
/* IGMPv3 */
11791179
igmpv3_add_delrec(in_dev, im);
11801180

11811181
igmp_ifc_event(in_dev);
11821182
}
1183-
done:
11841183
#endif
1185-
ip_mc_clear_src(im);
11861184
}
11871185

11881186
static void igmp_group_added(struct ip_mc_list *im)
@@ -1319,6 +1317,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
13191317
*ip = i->next_rcu;
13201318
in_dev->mc_count--;
13211319
igmp_group_dropped(i);
1320+
ip_mc_clear_src(i);
13221321

13231322
if (!in_dev->dead)
13241323
ip_rt_multicast_event(in_dev);
@@ -1428,7 +1427,8 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
14281427
in_dev->mc_list = i->next_rcu;
14291428
in_dev->mc_count--;
14301429

1431-
igmp_group_dropped(i);
1430+
/* We've dropped the groups in ip_mc_down already */
1431+
ip_mc_clear_src(i);
14321432
ip_ma_put(i);
14331433
}
14341434
}

0 commit comments

Comments
 (0)