Patchwork [1/2] Revert "bonding: remove sysfs before removing devices"

login
register
mail settings
Submitter Nikolay Aleksandrov
Date April 6, 2013, 10:54 a.m.
Message ID <1365245678-4455-1-git-send-email-nikolay@redhat.com>
Download mbox | patch
Permalink /patch/234325/
State Accepted
Delegated to: David Miller
Headers show

Comments

Nikolay Aleksandrov - April 6, 2013, 10:54 a.m.
This reverts commit 4de79c737b200492195ebc54a887075327e1ec1d.

This patch introduces a new bug which causes access to freed memory.
In bond_uninit: list_del(&bond->bond_list);
bond_list is linked in bond_net's dev_list which is freed by
unregister_pernet_subsys.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
 drivers/net/bonding/bond_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
David Miller - April 8, 2013, 8:45 p.m.
From: Nikolay Aleksandrov <nikolay@redhat.com>
Date: Sat,  6 Apr 2013 12:54:37 +0200

> This reverts commit 4de79c737b200492195ebc54a887075327e1ec1d.
> 
> This patch introduces a new bug which causes access to freed memory.
> In bond_uninit: list_del(&bond->bond_list);
> bond_list is linked in bond_net's dev_list which is freed by
> unregister_pernet_subsys.
> 
> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 171b10f..a51241b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4902,8 +4902,8 @@  static void __exit bonding_exit(void)
 
 	bond_destroy_debugfs();
 
-	unregister_pernet_subsys(&bond_net_ops);
 	rtnl_link_unregister(&bond_link_ops);
+	unregister_pernet_subsys(&bond_net_ops);
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	/*