bat_events: page allocation failure (batman-adv maint)

Message ID 20100125064747.GS24649@lunn.ch (mailing list archive)
State Accepted, archived
Headers

Commit Message

Andrew Lunn Jan. 25, 2010, 6:47 a.m. UTC
  Staging: batman-adv: Fix skbuff leak in VIS code.

The vis code takes a copy of the data inside the skbuf if it is interesting 
for us, so we always need to release the skbuf.

Reported-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
  

Comments

Marek Lindner Jan. 25, 2010, 8:21 a.m. UTC | #1
On Monday 25 January 2010 14:47:47 Andrew Lunn wrote:
> Staging: batman-adv: Fix skbuff leak in VIS code.
> 
> The vis code takes a copy of the data inside the skbuf if it is
>  interesting  for us, so we always need to release the skbuf.

Applied in rev 1564.

Thanks,
Marek
  
Linus Lüssing Jan. 26, 2010, 1:48 a.m. UTC | #2
Just tried the patch on the routers and it works perfectly, no
more memory leak caused by vis! Thanks for the quick fix.

Cheers, Linus
  

Patch

Index: routing.c
===================================================================
--- routing.c	(revision 1563)
+++ routing.c	(working copy)
@@ -1135,21 +1135,22 @@ 
 	if (is_my_mac(vis_packet->sender_orig))
 		return NET_RX_DROP;
 
+	/* We take a copy of the data in the packet, so we should
+	   always free the skbuf. */
+	ret = NET_RX_DROP;
+	
 	switch (vis_packet->vis_type) {
 	case VIS_TYPE_SERVER_SYNC:
 		/* TODO: handle fragmented skbs properly */
 		receive_server_sync_packet(vis_packet, skb_headlen(skb));
-		ret = NET_RX_SUCCESS;
 		break;
 
 	case VIS_TYPE_CLIENT_UPDATE:
 		/* TODO: handle fragmented skbs properly */
 		receive_client_update_packet(vis_packet, skb_headlen(skb));
-		ret = NET_RX_SUCCESS;
 		break;
 
 	default:	/* ignore unknown packet */
-		ret = NET_RX_DROP;
 		break;
 	}
 	return ret;