From patchwork Sun Oct 16 16:53:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1275 Return-Path: Received: from contumacia.investici.org (contumacia.investici.org [178.255.144.35]) by open-mesh.org (Postfix) with ESMTPS id CFD5D60072C for ; Sun, 16 Oct 2011 18:54:35 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id DDD5FE8119; Sun, 16 Oct 2011 16:54:34 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org DDD5FE8119 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1318784075; bh=48fveL16q7qRSPhkPKfGk+CDxPiKvI6q+O1mYT3Z8HM=; h=From:To:Cc:Subject:Date:Message-Id; b=WnTr06cGlTRxUOhZDsbwvyKpu+3Q2JyXm3+Ww9uqYyK/5cVg4n2J9mS1HHU7/wKg5 m1AzWAvqx/ckF+r8j9ip9l/HS92Up8gRDsnEvw18AYv6g0UGBZmDqkJ2xpZwRuonOQ fcfYamZ8allzkHncXEwOxiYGe9EYDFE2cVcl1z2Y= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 16 Oct 2011 18:53:37 +0200 Message-Id: <1318784017-28150-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 Subject: [B.A.T.M.A.N.] [PATCHv2] 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: Sun, 16 Oct 2011 16:54:36 -0000 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 --- translation-table.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/translation-table.c b/translation-table.c index 2d2cfc1..d4a3917 100644 --- a/translation-table.c +++ b/translation-table.c @@ -1727,6 +1727,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); }