Unlock all spinlocks in batgat

Message ID 20080911135148.GA21632@sven-desktop.lazhur.ath.cx (mailing list archive)
State Accepted, archived
Headers

Commit Message

Sven Eckelmann Sept. 11, 2008, 1:51 p.m. UTC
  We leave get_ip_addr when a client was found in hash immediately, but have have
spinlocked hash_lock before. Spinlocks on non smp kernels are simple nops which
only disable peempt (only on peempt enabled kernels) and so will never lock
anything and no dead(spin)lock will happen.
More informations about this issue can be found in "Unreliable Guide To Locking"
under the section "Locks and Uniprocessor Kernels".

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman/linux/modules/gateway.c   |    1 +
 batman/linux/modules/gateway24.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
  

Patch

diff --git a/batman/linux/modules/gateway.c b/batman/linux/modules/gateway.c
index 999d3e6..5786be8 100644
--- a/batman/linux/modules/gateway.c
+++ b/batman/linux/modules/gateway.c
@@ -645,6 +645,7 @@  static struct gw_client *get_ip_addr(struct sockaddr_in *client_addr)
 
 	if (gw_client != NULL) {
 		DBG("found client in hash");
+		spin_unlock(&hash_lock);
 		return gw_client;
 	}
 
diff --git a/batman/linux/modules/gateway24.c b/batman/linux/modules/gateway24.c
index 48f31a7..44dfc0e 100644
--- a/batman/linux/modules/gateway24.c
+++ b/batman/linux/modules/gateway24.c
@@ -587,6 +587,7 @@  static struct gw_client *get_ip_addr(struct sockaddr_in *client_addr)
 
 	if (gw_client != NULL) {
 		printk(KERN_DEBUG "found client in hash");
+		spin_unlock(&hash_lock);
 		return gw_client;
 	}