batman-adv: use unregister_netdevice() when softif_create fails

Message ID 1320670668-26961-1-git-send-email-siwu@hrz.tu-chemnitz.de (mailing list archive)
State Accepted, archived
Commit c103efd9af4ca23f75d77ff10fb7af5a95ece3c3
Headers

Commit Message

Simon Wunderlich Nov. 7, 2011, 12:57 p.m. UTC
  When entering softif_create(), the rtnl lock has already been acquired
by store_mesh_iface().
(store_mesh_iface() -> hardif_enable_interface() -> softif_create)

In case of an error, we should therefore call unregister_netdevice()
instead of unregister_netdev().

unregister_netdev() tries to acquire the rtnl lock itself and deadlocks
in this situation. unregister_netdevice() assumes that the rtnl lock
is already been held.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
 soft-interface.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
  

Comments

Marek Lindner Nov. 8, 2011, 6:38 p.m. UTC | #1
On Monday, November 07, 2011 20:57:48 Simon Wunderlich wrote:
> When entering softif_create(), the rtnl lock has already been acquired
> by store_mesh_iface().
> (store_mesh_iface() -> hardif_enable_interface() -> softif_create)
> 
> In case of an error, we should therefore call unregister_netdevice()
> instead of unregister_netdev().
> 
> unregister_netdev() tries to acquire the rtnl lock itself and deadlocks
> in this situation. unregister_netdevice() assumes that the rtnl lock
> is already been held.

Applied in revision c103efd.

Thanks,
Marek
  

Patch

diff --git a/soft-interface.c b/soft-interface.c
index 45297c8..987c75a 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -874,7 +874,7 @@  unreg_debugfs:
 unreg_sysfs:
 	sysfs_del_meshif(soft_iface);
 unreg_soft_iface:
-	unregister_netdev(soft_iface);
+	unregister_netdevice(soft_iface);
 	return NULL;
 
 free_soft_iface: