Skip to content

bonding: fix 3ad slave (de)init

Veaceslav Falico netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bonding: correctly verify for the first slave in bond_enslavedrivers/net/bonding/bond_main.c+1 -10 replies
2/2bonding: verify if we still have slaves in bond_3ad_unbind_slave()drivers/net/bonding/bond_3ad.c+3 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 0/2] bonding: fix 3ad slave (de)init

After 1f718f0f4f97145f4072d2d72dcf85069ca7226d ("bonding: populate neighbour's private on enslave") the (de)linking of slaves in bond_enslave/bond_release_one happens in the correct places - after we've completely initialized the slave (for bond_enslave) and before we've even began to de-init the slave (for bond_release_one, respectively).

This was done to prevent any RCU readers to see the half-initialized slave (because the RCU readers aren't blocked by bond->lock or rtnl_lock usually).

However, 802.3ad logic, in several places, relied on the fact that the slave is still linked to the bond.

Fix it by correctly handling these cases - we shouldn't rely that the slave is linked before fully initialized and, respectively, that the slave is still linked while it's being removed.

CC Jay Vosburgh <[email protected]>
CC Andy Gospodarek <[email protected]>
---
 drivers/net/bonding/bond_3ad.c  | 4 +++-
 drivers/net/bonding/bond_main.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)