Skip to content

Commit

Permalink
bonding: correctly update link status during mii-commit phase
Browse files Browse the repository at this point in the history
bond_miimon_commit() marks the link UP after attempting to get the speed
and duplex settings for the link. There is a possibility that
bond_update_speed_duplex() could fail. This is another place where it
could result into an inconsistent bonding link state.

With this patch the link will be marked UP only if the speed and duplex
values retrieved have sane values and processed further.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mahesh Bandewar authored and davem330 committed Mar 28, 2017
1 parent c4adfc8 commit b5bf0f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/bonding/bond_main.c
Expand Up @@ -2125,7 +2125,12 @@ static void bond_miimon_commit(struct bonding *bond)
continue;

case BOND_LINK_UP:
bond_update_speed_duplex(slave);
if (bond_update_speed_duplex(slave)) {
netdev_warn(bond->dev,
"failed to get link speed/duplex for %s\n",
slave->dev->name);
continue;
}
bond_set_slave_link_state(slave, BOND_LINK_UP,
BOND_SLAVE_NOTIFY_NOW);
slave->last_link_up = jiffies;
Expand Down

0 comments on commit b5bf0f5

Please sign in to comment.