From: Antonio Quartulli <antonio@meshcoding.com>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Antonio Quartulli <antonio@meshcoding.com>
Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: release vlan object after checking the CRC
Date: Sun, 26 Jan 2014 15:24:16 +0100 [thread overview]
Message-ID: <1390746256-551-1-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <52E51A04.8020800@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>
---
translation-table.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/translation-table.c b/translation-table.c
index 3fca99d..097ca01 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -2248,6 +2248,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 */
@@ -2267,7 +2268,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-01-26 14:24 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-21 10:22 [B.A.T.M.A.N.] [PATCH maint] batman-adv: fix soft-interface MTU computation Antonio Quartulli
2014-01-21 10:31 ` Antonio Quartulli
2014-01-27 7:57 ` Marek Lindner
2014-01-21 18:43 ` Russell Senior
2014-01-21 19:00 ` Antonio Quartulli
2014-01-22 6:04 ` Russell Senior
2014-01-22 7:03 ` Antonio Quartulli
2014-01-22 7:04 ` [B.A.T.M.A.N.] memleak (Was: [PATCH maint] batman-adv: fix soft-interface MTU computation) Antonio Quartulli
2014-01-22 7:37 ` [B.A.T.M.A.N.] [PATCH maint] batman-adv: fix soft-interface MTU computation Daniel
2014-01-22 17:45 ` [B.A.T.M.A.N.] batman-adv: memory leak? Russell Senior
2014-01-22 17:46 ` Antonio Quartulli
2014-01-22 19:18 ` Russell Senior
2014-01-22 20:49 ` cmsv
2014-01-22 23:57 ` Russell Senior
2014-01-23 0:10 ` cmsv
2014-01-23 3:35 ` Daniel
2014-01-26 12:57 ` Daniel
2014-01-26 14:21 ` Antonio Quartulli
2014-01-26 14:24 ` Antonio Quartulli [this message]
2014-01-27 18:43 ` [B.A.T.M.A.N.] [PATCH maint] batman-adv: release vlan object after checking the CRC Russell Senior
2014-01-26 16:05 ` [B.A.T.M.A.N.] batman-adv: memory leak? cmsv
2014-01-26 16:07 ` Antonio Quartulli
2014-01-26 16:13 ` Antonio Quartulli
2014-01-27 17:55 ` cmsv
2014-01-28 1:21 ` Russell Senior
2014-01-28 1:30 ` cmsv
2014-01-29 8:10 ` Russell Senior
2014-01-29 21:48 ` cmsv
2014-02-08 3:08 ` cmsv
2014-02-08 10:53 ` Felix Fietkau
2014-02-12 7:23 ` Antonio Quartulli
2014-02-12 10:40 ` cmsv
2014-02-12 11:41 ` Antonio Quartulli
2014-02-13 0:55 ` cmsv
2014-02-13 7:23 ` Antonio Quartulli
2014-01-28 1:06 [B.A.T.M.A.N.] [PATCH maint] batman-adv: release vlan object after checking the CRC Antonio Quartulli
2014-01-29 4:45 ` Marek Lindner
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=1390746256-551-1-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--cc=b.a.t.m.a.n@lists.open-mesh.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).