From patchwork Fri Feb 19 15:18:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 12 Return-Path: Received: from londo.lunn.ch (londo.lunn.ch [80.238.139.98]) by open-mesh.net (Postfix) with ESMTP id 1310F15431A for ; Fri, 19 Feb 2010 16:41:17 +0100 (CET) Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1NiUd5-0003QC-00; Fri, 19 Feb 2010 16:18:55 +0100 From: Andrew Lunn To: gregkh@suse.de Date: Fri, 19 Feb 2010 16:18:09 +0100 Message-Id: <1266592691-13090-6-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.6.6.2 In-Reply-To: <1266592691-13090-5-git-send-email-andrew@lunn.ch> References: <1266592691-13090-1-git-send-email-andrew@lunn.ch> <1266592691-13090-2-git-send-email-andrew@lunn.ch> <1266592691-13090-3-git-send-email-andrew@lunn.ch> <1266592691-13090-4-git-send-email-andrew@lunn.ch> <1266592691-13090-5-git-send-email-andrew@lunn.ch> Sender: Andrew Lunn Cc: devel@linuxdriverproject.org, b.a.t.m.a.n@lists.open-mesh.net Subject: [B.A.T.M.A.N.] [PATCH 6/8] Staging: batman-adv: Fix skbuff leak in VIS code. X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2010 15:41:17 -0000 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 Luessing Signed-off-by: Andrew Lunn --- drivers/staging/batman-adv/routing.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index 7dc9aef..d89048b 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c @@ -939,7 +939,6 @@ int recv_vis_packet(struct sk_buff *skb) struct vis_packet *vis_packet; struct ethhdr *ethhdr; int hdr_size = sizeof(struct vis_packet); - int ret; if (skb_headlen(skb) < hdr_size) return NET_RX_DROP; @@ -962,18 +961,18 @@ int recv_vis_packet(struct sk_buff *skb) 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; + + /* We take a copy of the data in the packet, so we should + always free the skbuf. */ + return NET_RX_DROP; }