bonding: correctly verify for the first slave in bond_enslave
authorVeaceslav Falico <vfalico@redhat.com>
Fri, 27 Sep 2013 13:10:57 +0000 (15:10 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 28 Sep 2013 22:27:32 +0000 (15:27 -0700)
commit23c147e026bbb41dd26a2bda0404a95ea951072f
tree0fec92cb402ed64804cef9d1b04dd2c404f4455c
parentb91e1a1aa5d4f68ea5153bf65c54ebc693c30e4f
bonding: correctly verify for the first slave in bond_enslave

After commit 1f718f0f4f97145f4072d2d72dcf85069ca7226d ("bonding: populate
neighbour's private on enslave"), we've moved the actual 'linking' in the
end of the function - so that, once linked, the slave is ready to be used,
and is not still in the process of enslaving.

However, 802.3ad verified if it's the first slave by looking at the

if (bond_first_slave(bond) == new_slave)

which, because we've moved the linking to the end, became broken - on the
first slave bond_first_slave(bond) returns NULL.

Fix this by verifying if the prev_slave, that equals bond_last_slave(), is
actually populated - if it is - then it's not the first slave, and vice
versa.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c