mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 3.8-stable]  bonding: remove sysfs before removing devices
@ 2013-04-07 22:56 Jonghwan Choi
  0 siblings, 0 replies; only message in thread
From: Jonghwan Choi @ 2013-04-07 22:56 UTC (permalink / raw)
  To: 'Jonghwan Choi', linux-kernel
  Cc: stable, 'Jay Vosburgh', 'Veaceslav Falico'

This patch looks like it should be in the 3.8-stable tree, should we apply
it?

------------------

From: "Veaceslav Falico <vfalico@redhat.com>"

commit 4de79c737b200492195ebc54a887075327e1ec1d upstream

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>
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
---
 drivers/net/bonding/bond_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c
b/drivers/net/bonding/bond_main.c
index 27cdf1f..fb6b559 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4975,8 +4975,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
 	/*
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-04-07 22:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-07 22:56 [PATCH 3.8-stable] bonding: remove sysfs before removing devices Jonghwan Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®