public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: Correct sparse warning about different lock contexts for basic block
@ 2010-10-27  8:02 Sven Eckelmann
  2010-10-28  9:49 ` Sven Eckelmann
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Eckelmann @ 2010-10-27  8:02 UTC (permalink / raw)
  To: b.a.t.m.a.n

sparse noticed that if_list_lock is taken in some situations with bottom
halfes disabled in some SMP kernels and that we must always lock it with
spin_lock_bh.

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

diff --git a/batman-adv/hard-interface.c b/batman-adv/hard-interface.c
index 37f0f8b..b5514e3 100644
--- a/batman-adv/hard-interface.c
+++ b/batman-adv/hard-interface.c
@@ -441,9 +441,9 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
 
 	check_known_mac_addr(batman_if->net_dev->dev_addr);
 
-	spin_lock(&if_list_lock);
+	spin_lock_bh(&if_list_lock);
 	list_add_tail_rcu(&batman_if->list, &if_list);
-	spin_unlock(&if_list_lock);
+	spin_unlock_bh(&if_list_lock);
 
 	/* extra reference for return */
 	kref_get(&batman_if->refcount);
@@ -478,11 +478,11 @@ void hardif_remove_interfaces(void)
 	struct batman_if *batman_if, *batman_if_tmp;
 
 	rtnl_lock();
-	spin_lock(&if_list_lock);
+	spin_lock_bh(&if_list_lock);
 	list_for_each_entry_safe(batman_if, batman_if_tmp, &if_list, list) {
 		hardif_remove_interface(batman_if);
 	}
-	spin_unlock(&if_list_lock);
+	spin_unlock_bh(&if_list_lock);
 	rtnl_unlock();
 }
 
@@ -508,9 +508,9 @@ static int hard_if_event(struct notifier_block *this,
 		hardif_deactivate_interface(batman_if);
 		break;
 	case NETDEV_UNREGISTER:
-		spin_lock(&if_list_lock);
+		spin_lock_bh(&if_list_lock);
 		hardif_remove_interface(batman_if);
-		spin_unlock(&if_list_lock);
+		spin_unlock_bh(&if_list_lock);
 		break;
 	case NETDEV_CHANGEMTU:
 		if (batman_if->soft_iface)
-- 
1.7.2.3


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

end of thread, other threads:[~2010-10-28  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27  8:02 [B.A.T.M.A.N.] [PATCH] batman-adv: Correct sparse warning about different lock contexts for basic block Sven Eckelmann
2010-10-28  9:49 ` Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox