[maint,2/2] batman-adv: free skb on TVLV parsing success

Message ID 1392134707-2318-2-git-send-email-antonio@meshcoding.com (mailing list archive)
State Accepted, archived
Commit 9289542085d7e298b90c7b6fb6efb509dab69d8b
Headers

Commit Message

Antonio Quartulli Feb. 11, 2014, 4:05 p.m. UTC
  From: Antonio Quartulli <antonio@open-mesh.com>

When the TVLV parsing routine succeed the skb is left
untouched thus leading to a memory leak.

Fix this by consuming the skb in case of success.

Introduced by 0b6aa0d43767889eeda43a132cf5e73df4e63bf2
("batman-adv: tvlv - basic infrastructure")

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
 routing.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Marek Lindner Feb. 15, 2014, 12:36 a.m. UTC | #1
On Tuesday 11 February 2014 17:05:07 Antonio Quartulli wrote:
> From: Antonio Quartulli <antonio@open-mesh.com>
> 
> When the TVLV parsing routine succeed the skb is left
> untouched thus leading to a memory leak.
> 
> Fix this by consuming the skb in case of success.
> 
> Introduced by 0b6aa0d43767889eeda43a132cf5e73df4e63bf2
> ("batman-adv: tvlv - basic infrastructure")
> 
> Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
> ---
>  routing.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied in revision 9289542.

Thanks,
Marek
  

Patch

diff --git a/routing.c b/routing.c
index f7579d0..71bf698 100644
--- a/routing.c
+++ b/routing.c
@@ -1063,6 +1063,8 @@  int batadv_recv_unicast_tvlv(struct sk_buff *skb,
 
 	if (ret != NET_RX_SUCCESS)
 		ret = batadv_route_unicast_packet(skb, recv_if);
+	else
+		consume_skb(skb);
 
 	return ret;
 }