batman-adv: Call unregister_netdev on failures to get rtnl lock

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

Commit Message

Sven Eckelmann May 19, 2010, 11:43 a.m. UTC
  We must call unregister_netdev when we couldn't initialise the
batman-adv module and the soft_device was registered. There are two
version of the function which we can use:
 * unregister_netdevice - removes device
 * unregister_netdev - takes rtnl semaphore and remove device

We don't hold the semaphore in a error case. So we must use
unregister_netdev.

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

Comments

Marek Lindner May 21, 2010, 10:56 a.m. UTC | #1
On Wednesday 19 May 2010 19:43:48 Sven Eckelmann wrote:
> We must call unregister_netdev when we couldn't initialise the
> batman-adv module and the soft_device was registered. There are two
> version of the function which we can use:
>  * unregister_netdevice - removes device
>  * unregister_netdev - takes rtnl semaphore and remove device
> 
> We don't hold the semaphore in a error case. So we must use
> unregister_netdev

Applied in revision 1665.

Thanks,
Marek
  

Patch

diff --git a/batman-adv-kernelland/main.c b/batman-adv-kernelland/main.c
index cbabba6..51856a7 100644
--- a/batman-adv-kernelland/main.c
+++ b/batman-adv-kernelland/main.c
@@ -129,7 +129,7 @@  int init_module(void)
 unreg_sysfs:
 	sysfs_del_meshif(soft_device);
 unreg_soft_device:
-	unregister_netdevice(soft_device);
+	unregister_netdev(soft_device);
 free_soft_device:
 	free_netdev(soft_device);
 	soft_device = NULL;