From patchwork Thu Oct 8 16:08:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schultz X-Patchwork-Id: 527807 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8D6A3140D8A for ; Fri, 9 Oct 2015 03:09:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934443AbbJHQI7 (ORCPT ); Thu, 8 Oct 2015 12:08:59 -0400 Received: from mail.tpip.net ([92.43.49.48]:45655 "EHLO mail.tpip.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933809AbbJHQI5 (ORCPT ); Thu, 8 Oct 2015 12:08:57 -0400 Received: from office.tpip.net (office.tpip.net [92.43.51.2]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.tpip.net (Postfix) with ESMTPS id 75B444F414; Thu, 8 Oct 2015 16:08:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by office.tpip.net (Postfix) with ESMTP id 03C7EA2F79; Thu, 8 Oct 2015 18:08:54 +0200 (CEST) Received: from office.tpip.net ([127.0.0.1]) by localhost (office.tpip.net [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id pHL06PUQy6Cm; Thu, 8 Oct 2015 18:08:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by office.tpip.net (Postfix) with ESMTP id 838F7A2F78; Thu, 8 Oct 2015 18:08:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at tpip.net Received: from office.tpip.net ([127.0.0.1]) by localhost (office.tpip.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zFIzIz7NmWdH; Thu, 8 Oct 2015 18:08:53 +0200 (CEST) Received: from alice.tpip.org (unknown [192.168.13.53]) by office.tpip.net (Postfix) with ESMTPSA id 2A4DCA2F77; Thu, 8 Oct 2015 18:08:53 +0200 (CEST) From: Andreas Schultz To: netdev@vger.kernel.org Cc: Pravin B Shelar , "David S. Miller" Subject: [PATCH net v3 1/2] fix return of iptunnel_xmit Date: Thu, 8 Oct 2015 18:08:49 +0200 Message-Id: <1444320530-28706-1-git-send-email-aschultz@tpip.net> X-Mailer: git-send-email 2.1.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org All users of iptunnel_xmit expect the return value to be the packet length on success (>0), negative for a tx error and zero for a tx dropped error. In cset 0e6fbc5b6c6218987c93b8c7ca60cf786062899d the negative return case was lost. This bug was introduced when the ip_tunnel_core code was refactored. Fixes: 0e6fbc5b6c6218987c93b8c7ca60cf786062899d Signed-off-by: Andreas Schultz Acked-by: Jiri Benc Acked-by: Pravin B Shelar --- Change in v2: - remove unused variable pkt_len Change in v3: - reworked based on comment from Jiri Benc --- net/ipv4/ip_tunnel_core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index 84dce6a..5cced3b 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c @@ -80,9 +80,12 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, skb_shinfo(skb)->gso_segs ?: 1); err = ip_local_out_sk(sk, skb); - if (unlikely(net_xmit_eval(err))) - pkt_len = 0; - return pkt_len; + if (likely(net_xmit_eval(err) == 0)) + return pkt_len; + if (err < 0) + return err; + + return 0; } EXPORT_SYMBOL_GPL(iptunnel_xmit);