From patchwork Tue Oct 18 21:01:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1285 Return-Path: Received: from nm25-vm6.bullet.mail.ukl.yahoo.com (nm25-vm6.bullet.mail.ukl.yahoo.com [217.146.177.150]) by open-mesh.org (Postfix) with SMTP id 5816060083C for ; Tue, 18 Oct 2011 23:01:26 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.181] by nm25.bullet.mail.ukl.yahoo.com with NNFMP; 18 Oct 2011 21:01:25 -0000 Received: from [77.238.184.57] by tm12.bullet.mail.ukl.yahoo.com with NNFMP; 18 Oct 2011 21:01:25 -0000 Received: from [127.0.0.1] by smtp126.mail.ukl.yahoo.com with NNFMP; 18 Oct 2011 21:01:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1318971685; bh=qKs9Yaf5yXRzg2WF0E68+PpQNQZqpd0fxuUqqY7NP/U=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=KoEF6OVMtED/RoKV3ckFYnks3lvu19ur9vAGQ8EOsOcSAVsWAoVoKCPyk+90Z97xuf/DOkG+sgL5AMie1iEFEQ1Sq05q2sHIQ5q0tcBr1lS801DmNEERfLoHNEw2/GAr6skfhEQNHcQgyNWgd9rMgS6XJZKS7UDKhFe9C6M5e84= X-Yahoo-Newman-Id: 792013.65143.bm@smtp126.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: m_zebBgVM1m9p12JNAHFbsBh6_k7tfpShqv6aMclDca9aci Y6ERDBD2zD9mLiNVsUukEyDTtiCW6P1ArhXtF2o4ZQUYeITgKB83aOZQnoTO X_dFqYfdNbJ7jVPKNsbjYzoR0uZuS.l2oLG8CvmApduaZUnGxqluAxN9dJjD jl3S7I1hzidwX9zy6zhMhgVIBuBG0A60JtsMTduc4PHGFhFSw5gAarYUVbgx UmB682HNJQTUDOzpgqbCE5bnmYDz1zkOda3a_vhDX2vsX.kVzBJ8hkKmnqMw QeQlEe6l1P4quNQCM6jLREAYa_Sn5nIiYb3uH10sLLnGjp4yK6HUaNn4GLbg fRlZuX43G0puBKe6G3YcWxWdFtjVi1PbGNeo7EPC7IZCTnRrP X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@93.193.17.48 with plain) by smtp126.mail.ukl.yahoo.com with SMTP; 18 Oct 2011 21:01:25 +0000 GMT From: Marek Lindner To: davem@davemloft.net Date: Tue, 18 Oct 2011 23:01:08 +0200 Message-Id: <1318971669-941-2-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1318971669-941-1-git-send-email-lindner_marek@yahoo.de> References: <1318971669-941-1-git-send-email-lindner_marek@yahoo.de> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: fix tt_local_reset_flags() function X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 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: Tue, 18 Oct 2011 21:01:26 -0000 From: Antonio Quartulli Currently the counter of tt_local_entry structures (tt_local_num) is incremented each time the tt_local_reset_flags() is invoked causing the node to send wrong TT_REPONSE packets containing a copy of non-initialised memory thus corrupting other nodes global translation table and making higher level communication impossible. Reported-by: Junkeun Song Signed-off-by: Antonio Quartulli Acked-by: Junkeun Song Signed-off-by: Marek Lindner --- net/batman-adv/translation-table.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index fb6931d..f599db9 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -1668,6 +1668,8 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags) rcu_read_lock(); hlist_for_each_entry_rcu(tt_local_entry, node, head, hash_entry) { + if (!(tt_local_entry->flags & flags)) + continue; tt_local_entry->flags &= ~flags; atomic_inc(&bat_priv->num_local_tt); }