From patchwork Wed Oct 19 09:02:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 1291 Return-Path: Received: from cora.hrz.tu-chemnitz.de (cora.hrz.tu-chemnitz.de [134.109.228.40]) by open-mesh.org (Postfix) with ESMTPS id 80A5B60084A for ; Wed, 19 Oct 2011 11:02:30 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@tu-chemnitz.de; dkim-adsp=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tu-chemnitz.de; s=dkim2010; h=Message-Id:Date:Subject:Cc:To:From; bh=DF2oEt/0lhYEQdcfxk0KdFuWgEz9/VLI4UIXhHxSI3k=; b=w8iFOG14oaEcaRKGY826sxNSa1DITBix2P3TJLnTfvW1CRa2wj19JHcuu3EAsH3a8UBZviKAXUKDhqxkC23jHerKhhJ/iawEd5j3uJOncBrD5DYqsytoh3IPXJomInEeEqMZBXa5vB46bBMReL5XykmT82RmOV02F+uFtdghJ6A=; Received: from p57aa10f6.dip0.t-ipconnect.de ([87.170.16.246] helo=pandem0nium) by cora.hrz.tu-chemnitz.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1RGS2f-000085-TT; Wed, 19 Oct 2011 11:02:30 +0200 Received: from dotslash by pandem0nium with local (Exim 4.72) (envelope-from ) id 1RGS2e-0008PB-Tp; Wed, 19 Oct 2011 11:02:28 +0200 From: Simon Wunderlich To: b.a.t.m.a.n@lists.open-mesh.org Date: Wed, 19 Oct 2011 11:02:25 +0200 Message-Id: <1319014945-32281-1-git-send-email-siwu@hrz.tu-chemnitz.de> X-Mailer: git-send-email 1.7.2.5 X-Spam-Score: -1.0 (-) X-Spam-Report: --- Textanalyse SpamAssassin 3.3.1 (-1.0 Punkte) Fragen an/questions to: Postmaster TU Chemnitz * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP --- Ende Textanalyse X-Scan-Signature: e732f858814c7a815fb214039343b7c0 Cc: Simon Wunderlich Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries 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: Wed, 19 Oct 2011 09:02:30 -0000 struct tt_global_entry holds a reference to an orig_node which must be decremented before deallocating the structure. Signed-off-by: Simon Wunderlich tested-by: Alexey Fisher --- compat.c | 8 -------- compat.h | 1 - translation-table.c | 14 +++++++++++++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/compat.c b/compat.c index 88ceb40..1793904 100644 --- a/compat.c +++ b/compat.c @@ -36,12 +36,4 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu) kfree(tt_local_entry); } -void free_rcu_tt_global_entry(struct rcu_head *rcu) -{ - struct tt_global_entry *tt_global_entry; - - tt_global_entry = container_of(rcu, struct tt_global_entry, rcu); - kfree(tt_global_entry); -} - #endif /* < KERNEL_VERSION(3, 0, 0) */ diff --git a/compat.h b/compat.h index 43654e8..58c3c6a 100644 --- a/compat.h +++ b/compat.h @@ -63,7 +63,6 @@ void free_rcu_gw_node(struct rcu_head *rcu); void free_rcu_neigh_node(struct rcu_head *rcu); void free_rcu_softif_neigh(struct rcu_head *rcu); void free_rcu_tt_local_entry(struct rcu_head *rcu); -void free_rcu_tt_global_entry(struct rcu_head *rcu); #endif /* < KERNEL_VERSION(3, 0, 0) */ diff --git a/translation-table.c b/translation-table.c index 873fb3d..abf05cb 100644 --- a/translation-table.c +++ b/translation-table.c @@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry) kfree_rcu(tt_local_entry, rcu); } +static void tt_global_entry_free_rcu(struct rcu_head *rcu) +{ + struct tt_global_entry *tt_global_entry; + + tt_global_entry = container_of(rcu, struct tt_global_entry, rcu); + + if (tt_global_entry->orig_node) + orig_node_free_ref(tt_global_entry->orig_node); + + kfree(tt_global_entry); +} + static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) { if (atomic_dec_and_test(&tt_global_entry->refcount)) - kfree_rcu(tt_global_entry, rcu); + call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu); } static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,