Skip to content

Commit

Permalink
bonding: remove sysfs before removing devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Veaceslav Falico authored and David S. Miller committed Apr 5, 2013
1 parent 31d1670 commit 4de79c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4902,8 +4902,8 @@ static void __exit bonding_exit(void)

bond_destroy_debugfs();

rtnl_link_unregister(&bond_link_ops);
unregister_pernet_subsys(&bond_net_ops);
rtnl_link_unregister(&bond_link_ops);

#ifdef CONFIG_NET_POLL_CONTROLLER
/*
Expand Down

0 comments on commit 4de79c7

Please sign in to comment.