Skip to content

Commit 40baec2

Browse files
jay-vosburghdavem330
authored andcommitted
bonding: fix panic on non-ARPHRD_ETHER enslave failure
Since commit 7d5cd2ce529b, when bond_enslave fails on devices that are not ARPHRD_ETHER, if needed, it resets the bonding device back to ARPHRD_ETHER by calling ether_setup. Unfortunately, ether_setup clobbers dev->flags, clearing IFF_UP if the bond device is up, leaving it in a quasi-down state without having actually gone through dev_close. For bonding, if any periodic work queue items are active (miimon, arp_interval, etc), those will remain running, as they are stopped by bond_close. At this point, if the bonding module is unloaded or the bond is deleted, the system will panic when the work function is called. This panic is resolved by calling dev_close on the bond itself prior to calling ether_setup. Cc: Nikolay Aleksandrov <[email protected]> Signed-off-by: Jay Vosburgh <[email protected]> Fixes: 7d5cd2c ("bonding: correctly handle bonding type change on enslave failure") Acked-by: Nikolay Aleksandrov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e824de8 commit 40baec2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
17491749
slave_dev->dev_addr))
17501750
eth_hw_addr_random(bond_dev);
17511751
if (bond_dev->type != ARPHRD_ETHER) {
1752+
dev_close(bond_dev);
17521753
ether_setup(bond_dev);
17531754
bond_dev->flags |= IFF_MASTER;
17541755
bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;

0 commit comments

Comments
 (0)