Skip to content

Commit 4de79c7

Browse files
Veaceslav Falicodavem330
authored andcommitted
bonding: remove sysfs before removing devices
We have a race condition if we try to rmmod bonding and simultaneously add a bond master through sysfs. In bonding_exit() we first remove the devices (through rtnl_link_unregister() ) and only after that we remove the sysfs. If we manage to add a device through sysfs after that the devices were removed - we'll end up with that device/sysfs structure and with the module unloaded. Fix this by first removing the sysfs and only after that calling rtnl_link_unregister(). Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 31d1670 commit 4de79c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4902,8 +4902,8 @@ static void __exit bonding_exit(void)
49024902

49034903
bond_destroy_debugfs();
49044904

4905-
rtnl_link_unregister(&bond_link_ops);
49064905
unregister_pernet_subsys(&bond_net_ops);
4906+
rtnl_link_unregister(&bond_link_ops);
49074907

49084908
#ifdef CONFIG_NET_POLL_CONTROLLER
49094909
/*

0 commit comments

Comments
 (0)