b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven.eckelmann@gmx.de>
To: b.a.t.m.a.n@open-mesh.net
Subject: [B.A.T.M.A.N.] [PATCH] Unlock all spinlocks in batgat
Date: Thu, 11 Sep 2008 15:51:48 +0200	[thread overview]
Message-ID: <20080911135148.GA21632@sven-desktop.lazhur.ath.cx> (raw)

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(-)

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;
 	}
 
-- 
1.6.0.1



                 reply	other threads:[~2008-09-11 13:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080911135148.GA21632@sven-desktop.lazhur.ath.cx \
    --to=sven.eckelmann@gmx.de \
    --cc=b.a.t.m.a.n@open-mesh.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).