Commit 8cbdeec6 authored by Jay Vosburgh's avatar Jay Vosburgh Committed by David S. Miller

[BONDING]: Fix resource use after free

Fix bond_destroy and bond_free_all to not reference the struct
net_device after calling unregister_netdevice.

Bug and offending change reported by Moni Shoua <monis@voltaire.com>
Signed-off-by: default avatarJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce1d18e0
...@@ -1847,9 +1847,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1847,9 +1847,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
*/ */
void bond_destroy(struct bonding *bond) void bond_destroy(struct bonding *bond)
{ {
unregister_netdevice(bond->dev);
bond_deinit(bond->dev); bond_deinit(bond->dev);
bond_destroy_sysfs_entry(bond); bond_destroy_sysfs_entry(bond);
unregister_netdevice(bond->dev);
} }
/* /*
...@@ -4475,8 +4475,8 @@ static void bond_free_all(void) ...@@ -4475,8 +4475,8 @@ static void bond_free_all(void)
bond_mc_list_destroy(bond); bond_mc_list_destroy(bond);
/* Release the bonded slaves */ /* Release the bonded slaves */
bond_release_all(bond_dev); bond_release_all(bond_dev);
unregister_netdevice(bond_dev);
bond_deinit(bond_dev); bond_deinit(bond_dev);
unregister_netdevice(bond_dev);
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment