From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Antonio Quartulli <antonio@meshcoding.com>,
Marek Lindner <mareklindner@neomailbox.ch>
Subject: [PATCH 03/10] batman-adv: release vlan object after checking the CRC
Date: Mon, 17 Feb 2014 21:48:42 +0100 [thread overview]
Message-ID: <1392670129-2498-4-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1392670129-2498-1-git-send-email-antonio@meshcoding.com>
There is a refcounter unbalance in the CRC checking routine
invoked on OGM reception. A vlan object is retrieved (thus
its refcounter is increased by one) but it is never properly
released. This leads to a memleak because the vlan object
will never be free'd.
Fix this by releasing the vlan object after having read the
CRC.
Reported-by: Russell Senior <russell@personaltelco.net>
Reported-by: Daniel <daniel@makrotopia.org>
Reported-by: cmsv <cmsv@wirelesspt.net>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
net/batman-adv/translation-table.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index beba13f..c21c557 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2262,6 +2262,7 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
{
struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp;
struct batadv_orig_node_vlan *vlan;
+ uint32_t crc;
int i;
/* check if each received CRC matches the locally stored one */
@@ -2281,7 +2282,10 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
if (!vlan)
return false;
- if (vlan->tt.crc != ntohl(tt_vlan_tmp->crc))
+ crc = vlan->tt.crc;
+ batadv_orig_node_vlan_free_ref(vlan);
+
+ if (crc != ntohl(tt_vlan_tmp->crc))
return false;
}
--
1.8.5.3
next prev parent reply other threads:[~2014-02-17 20:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 20:48 [PATCH 00/10] pull request net: batman-adv 2014-02-17 Antonio Quartulli
2014-02-17 20:48 ` [PATCH 01/10] batman-adv: fix soft-interface MTU computation Antonio Quartulli
2014-02-17 21:13 ` David Miller
2014-02-18 6:44 ` [B.A.T.M.A.N.] " Antonio Quartulli
2014-02-18 18:22 ` David Miller
2014-02-18 20:41 ` David Miller
2014-02-18 20:57 ` Antonio Quartulli
2014-02-17 20:48 ` [PATCH 02/10] batman-adv: fix TT-TVLV parsing on OGM reception Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli [this message]
2014-02-17 20:48 ` [PATCH 04/10] batman-adv: properly check pskb_may_pull return value Antonio Quartulli
2014-02-17 20:48 ` [PATCH 05/10] batman-adv: avoid potential race condition when adding a new neighbour Antonio Quartulli
2014-02-17 20:48 ` [PATCH 06/10] batman-adv: fix potential orig_node reference leak Antonio Quartulli
2014-02-17 20:48 ` [PATCH 07/10] batman-adv: fix TT CRC computation by ensuring byte order Antonio Quartulli
2014-02-17 20:48 ` [PATCH 08/10] batman-adv: free skb on TVLV parsing success Antonio Quartulli
2014-02-17 20:48 ` [PATCH 09/10] batman-adv: avoid double free when orig_node initialization fails Antonio Quartulli
[not found] ` <1392670129-2498-1-git-send-email-antonio-x4xJYDvStAgysxA8WJXlww@public.gmane.org>
2014-02-17 20:48 ` [PATCH 10/10] batman-adv: fix potential kernel paging error for unicast transmissions Antonio Quartulli
2014-02-21 7:47 ` [PATCH 00/10] pull request net: batman-adv 2014-02-17 Antonio Quartulli
2014-02-25 20:36 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392670129-2498-4-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).