From patchwork Tue Feb 28 11:32:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 143419 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 15E37B6F62 for ; Tue, 28 Feb 2012 22:34:18 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965276Ab2B1LeQ (ORCPT ); Tue, 28 Feb 2012 06:34:16 -0500 Received: from nm5.bullet.mail.ukl.yahoo.com ([217.146.182.226]:21439 "HELO nm5.bullet.mail.ukl.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757032Ab2B1LeP (ORCPT ); Tue, 28 Feb 2012 06:34:15 -0500 Received: from [217.146.183.217] by nm5.bullet.mail.ukl.yahoo.com with NNFMP; 28 Feb 2012 11:34:14 -0000 Received: from [77.238.184.63] by tm10.bullet.mail.ukl.yahoo.com with NNFMP; 28 Feb 2012 11:34:14 -0000 Received: from [127.0.0.1] by smtp132.mail.ukl.yahoo.com with NNFMP; 28 Feb 2012 11:34:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1330428854; bh=wH3HEJKXeQHIIY64cAYdZozd5qVg4CL2wGTVpdKG5YI=; 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=lTiJim2sDWFgideLKcKfUbty3RdDbj9h8hPGaNo0heCFgARG9ofX6ruqPAnPDUgKS0M7ndDIMnCWgO/F0hhPUkV5tu8qKt3ymRjwoJYMwO0gDzO+npRnYtjHmvorEUA4ca7LyWey0LhNDWKkNKJfpRpF7Y5RzC9H5EXBuzYSeiQ= X-Yahoo-Newman-Id: 100442.43484.bm@smtp132.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: dkBFjlYVM1lLj3iExfeNWDToQHqmyngpCYTohgYq5b5AjiP 3cMbq7oaGulR0OJSPBBjC3QUH6Vdy9mnelcdTaSHnuNy1cf7dfqmsj0zQF7j FdEsjp8WVGBRLW7bCsJhEHpfn6pdi8B8R7cDWySSUTAVMFOjo3q3GhgnsoOG U1Bm_4WuQVOX2VX4unEuJocJaEyGbwvFnUcapod.8LlqBrOBUcwVUjKeyL7P 92t4RDEDv71fL5e11LwaRYVEsoaAIqessj5ZUV4caM5jsTXhgOprh.zvAKyx LG46co3axKELvYkx3zHeHupDg20C2V7VW1lu3kJDWl3OnxKtaPkhWo3.ME4x z5WHaUqVKtpvzRpCqy4p8gwqlFL22A4NVySWF3YHr4k7jVR.aHUdYxLsAFyp uXgymAOF_4Yk- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@119.236.110.45 with plain) by smtp132.mail.ukl.yahoo.com with SMTP; 28 Feb 2012 11:34:09 +0000 GMT From: Marek Lindner To: davem@davemloft.net Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann , Marek Lindner Subject: [PATCH 2/8] batman-adv: refactor tt_global_del() to avoid misalignment Date: Tue, 28 Feb 2012 19:32:22 +0800 Message-Id: <1330428748-23137-3-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1330428748-23137-1-git-send-email-lindner_marek@yahoo.de> References: <1330428748-23137-1-git-send-email-lindner_marek@yahoo.de> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Sven Eckelmann Signed-off-by: Sven Eckelmann Acked-by: Antonio Quartulli Signed-off-by: Marek Lindner --- net/batman-adv/translation-table.c | 42 ++++++++++++++++++----------------- 1 files changed, 22 insertions(+), 20 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index ff9a1b3..30c2d1b 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -657,29 +657,31 @@ void tt_global_del(struct bat_priv *bat_priv, struct tt_local_entry *tt_local_entry = NULL; tt_global_entry = tt_global_hash_find(bat_priv, addr); - if (!tt_global_entry) + if (!tt_global_entry || tt_global_entry->orig_node != orig_node) goto out; - if (tt_global_entry->orig_node == orig_node) { - if (roaming) { - /* if we are deleting a global entry due to a roam - * event, there are two possibilities: - * 1) the client roamed from node A to node B => we mark - * it with TT_CLIENT_ROAM, we start a timer and we - * wait for node B to claim it. In case of timeout - * the entry is purged. - * 2) the client roamed to us => we can directly delete - * the global entry, since it is useless now. */ - tt_local_entry = tt_local_hash_find(bat_priv, - tt_global_entry->common.addr); - if (!tt_local_entry) { - tt_global_entry->common.flags |= TT_CLIENT_ROAM; - tt_global_entry->roam_at = jiffies; - goto out; - } - } - _tt_global_del(bat_priv, tt_global_entry, message); + if (!roaming) + goto out_del; + + /* if we are deleting a global entry due to a roam + * event, there are two possibilities: + * 1) the client roamed from node A to node B => we mark + * it with TT_CLIENT_ROAM, we start a timer and we + * wait for node B to claim it. In case of timeout + * the entry is purged. + * 2) the client roamed to us => we can directly delete + * the global entry, since it is useless now. */ + tt_local_entry = tt_local_hash_find(bat_priv, + tt_global_entry->common.addr); + if (!tt_local_entry) { + tt_global_entry->common.flags |= TT_CLIENT_ROAM; + tt_global_entry->roam_at = jiffies; + goto out; } + +out_del: + _tt_global_del(bat_priv, tt_global_entry, message); + out: if (tt_global_entry) tt_global_entry_free_ref(tt_global_entry);