bonding: 802.3ad - fix agg_device_up

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 4cd6fe1c6483cde93e2ec91f58b7af9c9eea51ad
("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>

authored by Jiri Bohac and committed by David S. Miller 2430af8b 6f4d6dc1

+5 -2
+5 -2
drivers/net/bonding/bond_3ad.c
··· 1482 1483 static int agg_device_up(const struct aggregator *agg) 1484 { 1485 - return (netif_running(agg->slave->dev) && 1486 - netif_carrier_ok(agg->slave->dev)); 1487 } 1488 1489 /**
··· 1482 1483 static int agg_device_up(const struct aggregator *agg) 1484 { 1485 + struct port *port = agg->lag_ports; 1486 + if (!port) 1487 + return 0; 1488 + return (netif_running(port->slave->dev) && 1489 + netif_carrier_ok(port->slave->dev)); 1490 } 1491 1492 /**