From patchwork Thu Sep 25 19:15:59 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 5346 Received: from lana.hrz.tu-chemnitz.de (lana.hrz.tu-chemnitz.de [134.109.132.3]) by open-mesh.net (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id m8PJKZIN015734 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 25 Sep 2008 21:20:37 +0200 Received: from galba.hrz.tu-chemnitz.de ([134.109.133.156] helo=mailbox.hrz.tu-chemnitz.de) by lana.hrz.tu-chemnitz.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1KiwJk-00052k-0y for b.a.t.m.a.n@open-mesh.net; Thu, 25 Sep 2008 21:16:00 +0200 Received: from vpnclient-044.hrz.tu-chemnitz.de ([134.109.232.44] helo=sven-desktop) by mailbox.hrz.tu-chemnitz.de with smtp (Exim 4.69) (envelope-from ) id 1KiwJj-00053D-OJ for b.a.t.m.a.n@open-mesh.net; Thu, 25 Sep 2008 21:15:59 +0200 Received: by sven-desktop (nbSMTP-1.00) for uid 1000 sven.eckelmann@gmx.de; Thu, 25 Sep 2008 21:16:00 +0200 (CEST) Date: Thu, 25 Sep 2008 21:15:59 +0200 From: Sven Eckelmann To: b.a.t.m.a.n@open-mesh.net Message-ID: <20080925191559.GA8866@sven-desktop.lazhur.ath.cx> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Scan-Signature: 1c90534550b6c0ed116ec89d58e8972e Subject: [B.A.T.M.A.N.] [PATCH] Don't use iterator of wip_hash to delete bucket in vip_hash X-BeenThere: b.a.t.m.a.n@open-mesh.net X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2008 19:20:37 -0000 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) {