From patchwork Sat Oct 29 08:06:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1309 Return-Path: Received: from nm16.bullet.mail.ukl.yahoo.com (nm16.bullet.mail.ukl.yahoo.com [217.146.183.190]) by open-mesh.org (Postfix) with SMTP id B34E6600844 for ; Sat, 29 Oct 2011 10:07:16 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.211] by nm16.bullet.mail.ukl.yahoo.com with NNFMP; 29 Oct 2011 08:07:16 -0000 Received: from [77.238.184.69] by tm4.bullet.mail.ukl.yahoo.com with NNFMP; 29 Oct 2011 08:07:15 -0000 Received: from [127.0.0.1] by smtp138.mail.ukl.yahoo.com with NNFMP; 29 Oct 2011 08:07:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1319875635; bh=9PpPsKzwAXgV/hBm6EVZvWcKKsn5r1PxbhqF0JLxl1g=; 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=pNeWn7ILmnDz3U9hMT/2Z3aeg2sPAEKk0ctWaPCa0sCwbwS5t9Ap5BNWlLBYRjz2to7RPsfTev43eJM1veyv1dRPfILBLD7cUvSBzbzHtregeRQMr/TtDx1WOZnvemShZClWNb9p3BNvHRrcAH328NrICVKyQh5jmKI9H3Bi86k= X-Yahoo-Newman-Id: 960945.62386.bm@smtp138.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: vubQiyYVM1kHrLtw73iYVkbJNutVPzCjIHRKYeb5gxPTaRU OJJ1n6xsSm8bvmmFgVjjDQAIgXHvkosJPLSKqDlR5G4oFRD1Ama7eDfZG04s DAuM5u6Zp8VOUVY8Uuq0upz5nvMOUuVP1T8NdZJGUzreGXFxeRwlmuvx.ubB SFXOa4d6pTelQHa1Okl1sRD.6jtLL9IJVmp.vLtnMu4n61OEZeuKHUK6QSL8 9Erv42nKD9izroRwVpFOAoh7H2ZB_m0Yz66SGSbh.RLZU4jiu5vakjyOusGT YFxeIj0o.y_Q60umLw8T_lE7D9roQWzXxWu.4zp7K8vEwmQ1wvLI1jBfUmjY eKqPWc7UwH3TpfIV8wfdweZee4KPa43Sq14.p_SWN0Pm3Uivc7KXk_7W2 X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@78.46.248.235 with plain) by smtp138.mail.ukl.yahoo.com with SMTP; 29 Oct 2011 08:07:13 +0000 GMT From: Marek Lindner To: davem@davemloft.net Date: Sat, 29 Oct 2011 10:06:44 +0200 Message-Id: <1319875606-7794-2-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1319875606-7794-1-git-send-email-lindner_marek@yahoo.de> References: <1319875606-7794-1-git-send-email-lindner_marek@yahoo.de> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Simon Wunderlich , Marek Lindner , stable@kernel.org Subject: [B.A.T.M.A.N.] [PATCH 1/3] 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: Sat, 29 Oct 2011 08:07:16 -0000 From: Simon Wunderlich 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 Signed-off-by: Marek Lindner --- net/batman-adv/translation-table.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 873fb3d..abf05cb 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/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,