Skip to content

Commit

Permalink
bonding: 802.3ad - fix agg_device_up
Browse files Browse the repository at this point in the history
The slave member of struct aggregator does not necessarily point
to a slave which is part of the aggregator. It points to the
slave structure containing the aggregator structure, while
completely different slaves (or no slaves at all) may be part of
the aggregator.

The agg_device_up() function wrongly uses agg->slave to find the state
of the aggregator.  Use agg->lag_ports->slave instead. The bug has
been introduced by commit 4cd6fe1
("bonding: fix link down handling in 802.3ad mode").

Signed-off-by: Jiri Bohac <jbohac@suse.cz>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Bohac authored and David S. Miller committed Apr 20, 2011
1 parent 6f4d6dc commit 2430af8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/bonding/bond_3ad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1482,8 +1482,11 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,

static int agg_device_up(const struct aggregator *agg)
{
return (netif_running(agg->slave->dev) &&
netif_carrier_ok(agg->slave->dev));
struct port *port = agg->lag_ports;
if (!port)
return 0;
return (netif_running(port->slave->dev) &&
netif_carrier_ok(port->slave->dev));
}

/**
Expand Down

0 comments on commit 2430af8

Please sign in to comment.