Commit 24cf3af3fed5edcf90bc2a0ed181e6ce1513d2dc

Authored by Veaceslav Falico
Committed by David S. Miller
1 parent be3fc413da

igmp: call ip_mc_clear_src() only when we have no users of ip_mc_list

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>

Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff

... ... @@ -1155,20 +1155,18 @@
1155 1155  
1156 1156 if (!in_dev->dead) {
1157 1157 if (IGMP_V1_SEEN(in_dev))
1158   - goto done;
  1158 + return;
1159 1159 if (IGMP_V2_SEEN(in_dev)) {
1160 1160 if (reporter)
1161 1161 igmp_send_report(in_dev, im, IGMP_HOST_LEAVE_MESSAGE);
1162   - goto done;
  1162 + return;
1163 1163 }
1164 1164 /* IGMPv3 */
1165 1165 igmpv3_add_delrec(in_dev, im);
1166 1166  
1167 1167 igmp_ifc_event(in_dev);
1168 1168 }
1169   -done:
1170 1169 #endif
1171   - ip_mc_clear_src(im);
1172 1170 }
1173 1171  
1174 1172 static void igmp_group_added(struct ip_mc_list *im)
... ... @@ -1305,6 +1303,7 @@
1305 1303 *ip = i->next_rcu;
1306 1304 in_dev->mc_count--;
1307 1305 igmp_group_dropped(i);
  1306 + ip_mc_clear_src(i);
1308 1307  
1309 1308 if (!in_dev->dead)
1310 1309 ip_rt_multicast_event(in_dev);
... ... @@ -1414,7 +1413,8 @@
1414 1413 in_dev->mc_list = i->next_rcu;
1415 1414 in_dev->mc_count--;
1416 1415  
1417   - igmp_group_dropped(i);
  1416 + /* We've dropped the groups in ip_mc_down already */
  1417 + ip_mc_clear_src(i);
1418 1418 ip_ma_put(i);
1419 1419 }
1420 1420 }