bonding: fix panic on non-ARPHRD_ETHER enslave failure
authorJay Vosburgh <jay.vosburgh@canonical.com>
Sat, 7 Nov 2015 01:23:23 +0000 (17:23 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Nov 2015 18:17:32 +0000 (13:17 -0500)
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 <nikolay@cumulusnetworks.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Fixes: 7d5cd2ce5292 ("bonding: correctly handle bonding type change on enslave failure")
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c

index b4351caf8e013dbe15fcaf7402e8c9dbaeee9abb..9e0f8a7ef8b1695e0b79c8324e6adfe2e0ed9f4e 100644 (file)
@@ -1749,6 +1749,7 @@ err_undo_flags:
                                            slave_dev->dev_addr))
                        eth_hw_addr_random(bond_dev);
                if (bond_dev->type != ARPHRD_ETHER) {
+                       dev_close(bond_dev);
                        ether_setup(bond_dev);
                        bond_dev->flags |= IFF_MASTER;
                        bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;