Skip to content

Commit

Permalink
bonding: Change active slave quietly when bond is down
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Dec 16, 2010
1 parent 8387451 commit ffa95ed
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,11 +1178,13 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
bond_do_fail_over_mac(bond, new_active,
old_active);

bond->send_grat_arp = bond->params.num_grat_arp;
bond_send_gratuitous_arp(bond);
if (netif_running(bond->dev)) {
bond->send_grat_arp = bond->params.num_grat_arp;
bond_send_gratuitous_arp(bond);

bond->send_unsol_na = bond->params.num_unsol_na;
bond_send_unsolicited_na(bond);
bond->send_unsol_na = bond->params.num_unsol_na;
bond_send_unsolicited_na(bond);
}

write_unlock_bh(&bond->curr_slave_lock);
read_unlock(&bond->lock);
Expand All @@ -1196,8 +1198,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)

/* resend IGMP joins since active slave has changed or
* all were sent on curr_active_slave */
if ((USES_PRIMARY(bond->params.mode) && new_active) ||
bond->params.mode == BOND_MODE_ROUNDROBIN) {
if (((USES_PRIMARY(bond->params.mode) && new_active) ||
bond->params.mode == BOND_MODE_ROUNDROBIN) &&
netif_running(bond->dev)) {
bond->igmp_retrans = bond->params.resend_igmp;
queue_delayed_work(bond->wq, &bond->mcast_work, 0);
}
Expand Down

0 comments on commit ffa95ed

Please sign in to comment.