aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-12-13 03:19:56 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-16 15:43:22 -0500
commitffa95ed50f9fb2d8faaa6bd73086a7056ea46a06 (patch)
tree17502c5275b8f28563ccfd15f23fe85a5e2dabfe
parent8387451e558853f7b513790c0070e3b6f0c135aa (diff)
bonding: Change active slave quietly when bond is down
bond_change_active_slave() may be called when a slave is added, even if the bond has not been brought up yet. It may then attempt to send packets, and further it may use mcast_work which is uninitialised before the bond is brought up. Add the necessary checks for netif_running(bond->dev). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bonding/bond_main.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ef370c923341..3b16c34ed86e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1178,11 +1178,13 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1178 bond_do_fail_over_mac(bond, new_active, 1178 bond_do_fail_over_mac(bond, new_active,
1179 old_active); 1179 old_active);
1180 1180
1181 bond->send_grat_arp = bond->params.num_grat_arp; 1181 if (netif_running(bond->dev)) {
1182 bond_send_gratuitous_arp(bond); 1182 bond->send_grat_arp = bond->params.num_grat_arp;
1183 bond_send_gratuitous_arp(bond);
1183 1184
1184 bond->send_unsol_na = bond->params.num_unsol_na; 1185 bond->send_unsol_na = bond->params.num_unsol_na;
1185 bond_send_unsolicited_na(bond); 1186 bond_send_unsolicited_na(bond);
1187 }
1186 1188
1187 write_unlock_bh(&bond->curr_slave_lock); 1189 write_unlock_bh(&bond->curr_slave_lock);
1188 read_unlock(&bond->lock); 1190 read_unlock(&bond->lock);
@@ -1196,8 +1198,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1196 1198
1197 /* resend IGMP joins since active slave has changed or 1199 /* resend IGMP joins since active slave has changed or
1198 * all were sent on curr_active_slave */ 1200 * all were sent on curr_active_slave */
1199 if ((USES_PRIMARY(bond->params.mode) && new_active) || 1201 if (((USES_PRIMARY(bond->params.mode) && new_active) ||
1200 bond->params.mode == BOND_MODE_ROUNDROBIN) { 1202 bond->params.mode == BOND_MODE_ROUNDROBIN) &&
1203 netif_running(bond->dev)) {
1201 bond->igmp_retrans = bond->params.resend_igmp; 1204 bond->igmp_retrans = bond->params.resend_igmp;
1202 queue_delayed_work(bond->wq, &bond->mcast_work, 0); 1205 queue_delayed_work(bond->wq, &bond->mcast_work, 0);
1203 } 1206 }