From patchwork Mon Jun 20 17:53:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16386 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 CFB0381D18; Mon, 20 Jun 2016 19:53:38 +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=rjreqcWR; 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 2387F81D16 for ; Mon, 20 Jun 2016 19:53:37 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p200300C593C047F90000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c0:47f9::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 7D01D1100E8; Mon, 20 Jun 2016 19:53:36 +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=1466445216; bh=wv3Iu6JUUoX3h6ukW414ueaNwgqMlLJjrhOjk5BRSsw=; h=From:To:Cc:Subject:Date:From; b=rjreqcWRvHZl4IdKbqP2iFKCUVPXlrOwqSA9oaJUxXJUxVKsJeFEb96JCuNsP45Pr apBLWiWZ9NgGD5jWTQlmcEpAnRxaWu8ElCgnt0Rm9Vqgu95kT0nI+fYxVVSNe1NTf2 9l3uob4pR09OTO075cqnUnCmjbL8EohYp4eaU2rQ= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 20 Jun 2016 19:53:27 +0200 Message-Id: <1466445210-17616-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 Subject: [B.A.T.M.A.N.] [PATCH next v2 1/4] 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 --- v2: - rebased on current master - added patch to a common set of related patches 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;