From patchwork Fri Jun 10 16:14:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16363 X-Patchwork-Delegate: mareklindner@neomailbox.ch Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 43E5F8193F; Fri, 10 Jun 2016 18:14:24 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=fH1jwNmj; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id 01720805D6 for ; Fri, 10 Jun 2016 18:14:16 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p2003007C6F7F40FEB149D56F9BE1D27E.dip0.t-ipconnect.de [IPv6:2003:7c:6f7f:40fe:b149:d56f:9be1:d27e]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 241F91C8001; Fri, 10 Jun 2016 18:14:16 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1465575256; bh=B47nfTnSYoz2jl9mbCMJ2oJzR+mfQsyzBSGJ8k4Ryc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fH1jwNmjiaEP2ZgTC5YTgwYbZwMwmUv3OGc6t46uKbPURvOUxooAk2SFF3ZQJ9Alx HASmXJh/0TDRzR9NIhH/yEchT186fiR6WT2lNW6BS95Bwv3UnE3Vs1Txo5PEEK0Xm/ g51htEwUpuOS4cG2AadP/woHVtMzEIkKXim2tYWQ= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 10 Jun 2016 18:14:01 +0200 Message-Id: <1465575241-1754-2-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1465575241-1754-1-git-send-email-sven@narfation.org> References: <1465575241-1754-1-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH next] batman-adv: Free tp_meter ack skb when it was not consumed X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" batadv_send_skb_to_orig can return -1 to signal that the skb was not consumed. tp_meter has then to free the skb to avoid a memory leak. Fixes: 98d7a766b645 ("batman-adv: throughput meter implementation") Signed-off-by: Sven Eckelmann --- Antonio, this is not really tested. Could you please review it and tell me if I may have missed something. net/batman-adv/tp_meter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index bf6bffb..2333777 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -1206,6 +1206,9 @@ static int batadv_tp_send_ack(struct batadv_priv *bat_priv, const u8 *dst, /* send the ack */ r = batadv_send_skb_to_orig(skb, orig_node, NULL); + if (r == -1) + kfree_skb(skb); + if (unlikely(r < 0) || (r == NET_XMIT_DROP)) { ret = BATADV_TP_REASON_DST_UNREACHABLE; goto out;