From patchwork Fri Jun 10 16:14:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16362 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 3F0078034E; Fri, 10 Jun 2016 18:14:16 +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=Y7nent8D; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=79.140.41.39; 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 [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id B9D0A800ED for ; Fri, 10 Jun 2016 18:14:13 +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 BA8DC1C8001; Fri, 10 Jun 2016 18:14:12 +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=1465575252; bh=AXNZsEEDItUmlzNtXPCFunzGEyETHELYqNdgKlPXQq4=; h=From:To:Cc:Subject:Date:From; b=Y7nent8DkEnZ8DhTclzvAWdEDmhOKQLWoKi2uconqzmQ7dDCRRdHJ0Tl8bHS+6YNV AA6bUp+pPsxJCWNkwHS+A5VwR1xzw79IEaVGIfVHQSenDwcFkcML1D2SwiyI/wi9G/ KIIPzYgA6nxxt6I4ac43xKz8OZDopjpU5Rhd5IMY= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 10 Jun 2016 18:14:00 +0200 Message-Id: <1465575241-1754-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 Subject: [B.A.T.M.A.N.] [PATCH next] batman-adv: Avoid skb free for batadv_send_skb_to_orig < -1 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" The tp_meter code frees the skb when the batadv_send_skb_to_orig returns < 0. But the batadv_send_skb_to_orig only defines -1 as return code for failed submits with still valid skbs. Fixes: 98d7a766b645 ("batman-adv: throughput meter implementation") Signed-off-by: Sven Eckelmann --- Interesting because a patch was submitted to net next to remove NET_XMIT_POLICED and return -EINPROGRESS instead. I will maybe later send more patches because the current way of handling DROPPED/free'd skb/not-freed skb is quite confusing. net/batman-adv/tp_meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index ed99afb..bf6bffb 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -615,7 +615,7 @@ static int batadv_tp_send_msg(struct batadv_tp_vars *tp_vars, const u8 *src, batadv_tp_fill_prerandom(tp_vars, data, data_len); r = batadv_send_skb_to_orig(skb, orig_node, NULL); - if (r < 0) + if (r == -1) kfree_skb(skb); if (r == NET_XMIT_SUCCESS)