netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.5.70] Tun device encapsulation
       [not found] ` <20030604212528.GA24515@conectiva.com.br>
@ 2003-06-04 22:40   ` Stephen Hemminger
  2003-06-04 22:46     ` jjs
                       ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Hemminger @ 2003-06-04 22:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, David S. Miller, Jeff Garzik
  Cc: akpm, davem, jjs, netdev

Tun device was encapsulating the net_device in a private structure then doing:
	unregister_netdev(&tun->dev);
	kfree(tun);
	rtnl_unlock();

This breaks with the delayed cleanup now in the network core.
Moving the kfree outside of the rtnl_unlock will fix it.

Builds, but not sure how to use TUN to test it.

As part of later refcounting changes, I do have a more complex change
that uses the same encapsulation as ethernet and other
devices.  Will save it for later.

diff -Nru a/drivers/net/tun.c b/drivers/net/tun.c
--- a/drivers/net/tun.c	Wed Jun  4 15:38:44 2003
+++ b/drivers/net/tun.c	Wed Jun  4 15:38:44 2003
@@ -551,10 +551,12 @@
 	if (!(tun->flags & TUN_PERSIST)) {
 		dev_close(&tun->dev);
 		unregister_netdevice(&tun->dev);
-		kfree(tun);
 	}
 
 	rtnl_unlock();
+
+	if (!(tun->flags & TUN_PERSIST)) 
+		kfree(tun);
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.5.70] Tun device encapsulation
  2003-06-04 22:40   ` [PATCH 2.5.70] Tun device encapsulation Stephen Hemminger
@ 2003-06-04 22:46     ` jjs
  2003-06-05  5:33     ` Joe
  2003-06-05  6:50     ` David S. Miller
  2 siblings, 0 replies; 4+ messages in thread
From: jjs @ 2003-06-04 22:46 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Arnaldo Carvalho de Melo, David S. Miller, Jeff Garzik, akpm,
	netdev

I'll be happy to test it out later -

Thanks,

Joe

Stephen Hemminger wrote:

>Tun device was encapsulating the net_device in a private structure then doing:
>	unregister_netdev(&tun->dev);
>	kfree(tun);
>	rtnl_unlock();
>
>This breaks with the delayed cleanup now in the network core.
>Moving the kfree outside of the rtnl_unlock will fix it.
>
>Builds, but not sure how to use TUN to test it.
>
>As part of later refcounting changes, I do have a more complex change
>that uses the same encapsulation as ethernet and other
>devices.  Will save it for later.
>
>diff -Nru a/drivers/net/tun.c b/drivers/net/tun.c
>--- a/drivers/net/tun.c	Wed Jun  4 15:38:44 2003
>+++ b/drivers/net/tun.c	Wed Jun  4 15:38:44 2003
>@@ -551,10 +551,12 @@
> 	if (!(tun->flags & TUN_PERSIST)) {
> 		dev_close(&tun->dev);
> 		unregister_netdevice(&tun->dev);
>-		kfree(tun);
> 	}
> 
> 	rtnl_unlock();
>+
>+	if (!(tun->flags & TUN_PERSIST)) 
>+		kfree(tun);
> 	return 0;
> }
> 
>
>  
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.5.70] Tun device encapsulation
  2003-06-04 22:40   ` [PATCH 2.5.70] Tun device encapsulation Stephen Hemminger
  2003-06-04 22:46     ` jjs
@ 2003-06-05  5:33     ` Joe
  2003-06-05  6:50     ` David S. Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Joe @ 2003-06-05  5:33 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Arnaldo Carvalho de Melo, David S. Miller, Jeff Garzik, akpm, jjs,
	netdev

This fixes the tun problem nicely here -

Joe

Stephen Hemminger wrote:

>Tun device was encapsulating the net_device in a private structure then doing:
>	unregister_netdev(&tun->dev);
>	kfree(tun);
>	rtnl_unlock();
>
>This breaks with the delayed cleanup now in the network core.
>Moving the kfree outside of the rtnl_unlock will fix it.
>
>Builds, but not sure how to use TUN to test it.
>
>As part of later refcounting changes, I do have a more complex change
>that uses the same encapsulation as ethernet and other
>devices.  Will save it for later.
>
>diff -Nru a/drivers/net/tun.c b/drivers/net/tun.c
>--- a/drivers/net/tun.c	Wed Jun  4 15:38:44 2003
>+++ b/drivers/net/tun.c	Wed Jun  4 15:38:44 2003
>@@ -551,10 +551,12 @@
> 	if (!(tun->flags & TUN_PERSIST)) {
> 		dev_close(&tun->dev);
> 		unregister_netdevice(&tun->dev);
>-		kfree(tun);
> 	}
> 
> 	rtnl_unlock();
>+
>+	if (!(tun->flags & TUN_PERSIST)) 
>+		kfree(tun);
> 	return 0;
> }
> 
>
>
>  
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.5.70] Tun device encapsulation
  2003-06-04 22:40   ` [PATCH 2.5.70] Tun device encapsulation Stephen Hemminger
  2003-06-04 22:46     ` jjs
  2003-06-05  5:33     ` Joe
@ 2003-06-05  6:50     ` David S. Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2003-06-05  6:50 UTC (permalink / raw)
  To: shemminger; +Cc: acme, jgarzik, akpm, jjs, netdev

   From: Stephen Hemminger <shemminger@osdl.org>
   Date: Wed, 4 Jun 2003 15:40:22 -0700

   Tun device was encapsulating the net_device in a private structure
   then doing:

   	unregister_netdev(&tun->dev);
   	kfree(tun);
   	rtnl_unlock();
   
   This breaks with the delayed cleanup now in the network core.
   Moving the kfree outside of the rtnl_unlock will fix it.
   
   Builds, but not sure how to use TUN to test it.
   
This seems to indeed fix the problem for people, applied thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-06-05  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20030604115236.309a173d.akpm@digeo.com>
     [not found] ` <20030604212528.GA24515@conectiva.com.br>
2003-06-04 22:40   ` [PATCH 2.5.70] Tun device encapsulation Stephen Hemminger
2003-06-04 22:46     ` jjs
2003-06-05  5:33     ` Joe
2003-06-05  6:50     ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).