提交 91c2b1a9 编写于 作者: A Antonio Quartulli

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: NRussell Senior <russell@personaltelco.net>
Reported-by: NDaniel <daniel@makrotopia.org>
Reported-by: Ncmsv <cmsv@wirelesspt.net>
Signed-off-by: NAntonio Quartulli <antonio@meshcoding.com>
Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
上级 e889241f
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册