batman-adv: Don't call free_netdev twice

Message ID 1274277722-25571-1-git-send-email-sven.eckelmann@gmx.de (mailing list archive)
State Superseded, archived
Headers

Commit Message

Sven Eckelmann May 19, 2010, 2:02 p.m. UTC
  Free_netdev is registered as destructor in interface_setup for every
soft_device. This destructor is automatically called from
unregister_netdev and we must not call it again for the freed
net_device.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman-adv-kernelland/main.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
  

Comments

Marek Lindner May 21, 2010, 10:56 a.m. UTC | #1
On Wednesday 19 May 2010 22:02:02 Sven Eckelmann wrote:
> Free_netdev is registered as destructor in interface_setup for every
> soft_device. This destructor is automatically called from
> unregister_netdev and we must not call it again for the freed
> net_device.

Applied in rev 1665.

Thanks,
Marek
  
Marek Lindner May 21, 2010, 10:57 a.m. UTC | #2
On Friday 21 May 2010 18:56:08 Marek Lindner wrote:
> On Wednesday 19 May 2010 22:02:02 Sven Eckelmann wrote:
> > Free_netdev is registered as destructor in interface_setup for every
> > soft_device. This destructor is automatically called from
> > unregister_netdev and we must not call it again for the freed
> > net_device.
> 
> Applied in rev 1665.

Sorry, revision 1666.

Cheers,
Marek
  

Patch

diff --git a/batman-adv-kernelland/main.c b/batman-adv-kernelland/main.c
index 51856a7..c9132c0 100644
--- a/batman-adv-kernelland/main.c
+++ b/batman-adv-kernelland/main.c
@@ -130,6 +130,9 @@  unreg_sysfs:
 	sysfs_del_meshif(soft_device);
 unreg_soft_device:
 	unregister_netdev(soft_device);
+	soft_device = NULL;
+	return -ENOMEM;
+
 free_soft_device:
 	free_netdev(soft_device);
 	soft_device = NULL;