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] Don't use iterator of wip_hash to delete bucket in vip_hash
Date: Thu, 25 Sep 2008 21:15:59 +0200	[thread overview]
Message-ID: <20080925191559.GA8866@sven-desktop.lazhur.ath.cx> (raw)

The hash iterator of a hash has different pointers inside of it. When somebody
tries to delete a bucket in another hash with hash_remove_bucket most data will
be changed in the hash the iterator belongs and not the target hash.
---
 batman/linux/modules/gateway.c   |    2 +-
 batman/linux/modules/gateway24.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/batman/linux/modules/gateway.c b/batman/linux/modules/gateway.c
index 1f2dc24..fcf4dd2 100644
--- a/batman/linux/modules/gateway.c
+++ b/batman/linux/modules/gateway.c
@@ -383,7 +383,7 @@ static int packet_recv_thread(void *data)
 					if( ( jiffies - client_data->last_keep_alive ) / HZ > LEASE_TIME ) {
 
 						hash_remove_bucket(wip_hash, hashit);
-						hash_remove_bucket(vip_hash, hashit);
+						hash_remove(vip_hash, client_data);
 
 						tmp_entry = kmalloc(sizeof(struct free_client_data), GFP_KERNEL);
 						if(tmp_entry != NULL) {
diff --git a/batman/linux/modules/gateway24.c b/batman/linux/modules/gateway24.c
index a8d58e6..e26154b 100644
--- a/batman/linux/modules/gateway24.c
+++ b/batman/linux/modules/gateway24.c
@@ -364,7 +364,7 @@ static int packet_recv_thread(void *data)
 					if( ( jiffies - client_data->last_keep_alive ) / HZ > LEASE_TIME ) {
 
 						hash_remove_bucket(wip_hash, hashit);
-						hash_remove_bucket(vip_hash, hashit);
+						hash_remove(vip_hash, client_data);
 
 						tmp_entry = kmalloc(sizeof(struct free_client_data), GFP_KERNEL);
 						if(tmp_entry != NULL) {
-- 
1.6.0.1



                 reply	other threads:[~2008-09-25 19:15 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=20080925191559.GA8866@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).