diff options
author | Antonio Quartulli <antonio@meshcoding.com> | 2014-01-27 20:06:47 -0500 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2014-02-17 11:17:00 -0500 |
commit | 91c2b1a9f680ff105369d49abc7e19ca7efb33e1 (patch) | |
tree | d5449f16cab7d66c710acbfe16d036282d41adfc | |
parent | e889241f45f9cecbc84a6ffed577083ab52e62ee (diff) |
batman-adv: release vlan object after checking the CRC
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>
-rw-r--r-- | net/batman-adv/translation-table.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index beba13fbd10a..c21c5572c860 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, | |||
2262 | { | 2262 | { |
2263 | struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp; | 2263 | struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp; |
2264 | struct batadv_orig_node_vlan *vlan; | 2264 | struct batadv_orig_node_vlan *vlan; |
2265 | uint32_t crc; | ||
2265 | int i; | 2266 | int i; |
2266 | 2267 | ||
2267 | /* check if each received CRC matches the locally stored one */ | 2268 | /* 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, | |||
2281 | if (!vlan) | 2282 | if (!vlan) |
2282 | return false; | 2283 | return false; |
2283 | 2284 | ||
2284 | if (vlan->tt.crc != ntohl(tt_vlan_tmp->crc)) | 2285 | crc = vlan->tt.crc; |
2286 | batadv_orig_node_vlan_free_ref(vlan); | ||
2287 | |||
2288 | if (crc != ntohl(tt_vlan_tmp->crc)) | ||
2285 | return false; | 2289 | return false; |
2286 | } | 2290 | } |
2287 | 2291 | ||