diff mbox

[net] vxlan: fix crash on module removal

Message ID 20130605083700.2a09e379@nehalam.linuxnetplumber.net
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Stephen Hemminger June 5, 2013, 3:37 p.m. UTC
If vxlan is removed with active vxlan's it would crash because
rtnl_link_unregister (which calls vxlan_dellink), was invoked
before unregister_pernet_device (which calls vxlan_stop).

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
See "vxlan: move IGMP join/leave to work queue" for the net-next
version of this

 drivers/net/vxlan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cong Wang June 6, 2013, 1:11 a.m. UTC | #1
On Wed, 05 Jun 2013 at 15:37 GMT, Stephen Hemminger <stephen@networkplumber.org> wrote:
> If vxlan is removed with active vxlan's it would crash because
> rtnl_link_unregister (which calls vxlan_dellink), was invoked
> before unregister_pernet_device (which calls vxlan_stop).
>

Two points:

1. There are still many others drivers calling them in such order...
2. The removal should be in a reverse order of creation, at least in
theory.

I mean this *might* indicate something wrong.

--
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
Stephen Hemminger June 6, 2013, 1:32 a.m. UTC | #2
On Thu, 6 Jun 2013 01:11:11 +0000 (UTC)
Cong Wang <xiyou.wangcong@gmail.com> wrote:

> On Wed, 05 Jun 2013 at 15:37 GMT, Stephen Hemminger <stephen@networkplumber.org> wrote:
> > If vxlan is removed with active vxlan's it would crash because
> > rtnl_link_unregister (which calls vxlan_dellink), was invoked
> > before unregister_pernet_device (which calls vxlan_stop).
> >
> 
> Two points:
> 
> 1. There are still many others drivers calling them in such order...
> 2. The removal should be in a reverse order of creation, at least in
> theory.
> 
> I mean this *might* indicate something wrong.

1. Other drivers either don't have the dependency or are broken.
   It makes no sense to stop a device that is deleted.

2. The normal creation order is
   vxlan_setup
   vxlan_newlink
   vxlan_open

     
--
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
diff mbox

Patch

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3b1d2ee..5cc3b48 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1677,8 +1677,8 @@  module_init(vxlan_init_module);
 
 static void __exit vxlan_cleanup_module(void)
 {
-	rtnl_link_unregister(&vxlan_link_ops);
 	unregister_pernet_device(&vxlan_net_ops);
+	rtnl_link_unregister(&vxlan_link_ops);
 	rcu_barrier();
 }
 module_exit(vxlan_cleanup_module);