diff mbox

[net] fix return of iptunnel_xmit

Message ID 1444298104-4887-1-git-send-email-aschultz@tpip.net
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Andreas Schultz Oct. 8, 2015, 9:55 a.m. UTC
All users of iptunnel_xmit expect the return value to be the error
code from ip_output_local, but currently the return value is length
of the send data on success or zero on error.
Change iptunnel_xmit returns to match the callers expectation.

This bug was introduced when the ip_tunnel_core code was refactored.

Fixes: 0e6fbc5b6c6218987c93b8c7ca60cf786062899d
Signed-off-by: Andreas Schultz <aschultz@tpip.net>
---
 net/ipv4/ip_tunnel_core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

kernel test robot Oct. 8, 2015, 10:05 a.m. UTC | #1
Hi Andreas,

[auto build test WARNING on net/master -- if it's inappropriate base, please ignore]

config: microblaze-mmu_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=microblaze 

All warnings (new ones prefixed by >>):

   net/ipv4/ip_tunnel_core.c: In function 'iptunnel_xmit':
>> net/ipv4/ip_tunnel_core.c:55:6: warning: unused variable 'pkt_len' [-Wunused-variable]
     int pkt_len = skb->len - skb_inner_network_offset(skb);
         ^

vim +/pkt_len +55 net/ipv4/ip_tunnel_core.c

0e6fbc5b Pravin B Shelar 2013-06-17  39  #include <net/protocol.h>
0e6fbc5b Pravin B Shelar 2013-06-17  40  #include <net/ip_tunnels.h>
0e6fbc5b Pravin B Shelar 2013-06-17  41  #include <net/arp.h>
0e6fbc5b Pravin B Shelar 2013-06-17  42  #include <net/checksum.h>
0e6fbc5b Pravin B Shelar 2013-06-17  43  #include <net/dsfield.h>
0e6fbc5b Pravin B Shelar 2013-06-17  44  #include <net/inet_ecn.h>
0e6fbc5b Pravin B Shelar 2013-06-17  45  #include <net/xfrm.h>
0e6fbc5b Pravin B Shelar 2013-06-17  46  #include <net/net_namespace.h>
0e6fbc5b Pravin B Shelar 2013-06-17  47  #include <net/netns/generic.h>
0e6fbc5b Pravin B Shelar 2013-06-17  48  #include <net/rtnetlink.h>
63d008a4 Jiri Benc       2015-09-22  49  #include <net/dst_metadata.h>
0e6fbc5b Pravin B Shelar 2013-06-17  50  
aad88724 Eric Dumazet    2014-04-15  51  int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
0e6fbc5b Pravin B Shelar 2013-06-17  52  		  __be32 src, __be32 dst, __u8 proto,
963a88b3 Nicolas Dichtel 2013-09-02  53  		  __u8 tos, __u8 ttl, __be16 df, bool xnet)
0e6fbc5b Pravin B Shelar 2013-06-17  54  {
bc22a0e2 Nicolas Dichtel 2015-09-18 @55  	int pkt_len = skb->len - skb_inner_network_offset(skb);
0e6fbc5b Pravin B Shelar 2013-06-17  56  	struct iphdr *iph;
0e6fbc5b Pravin B Shelar 2013-06-17  57  
963a88b3 Nicolas Dichtel 2013-09-02  58  	skb_scrub_packet(skb, xnet);
963a88b3 Nicolas Dichtel 2013-09-02  59  
7539fadc Tom Herbert     2013-12-15  60  	skb_clear_hash(skb);
0e6fbc5b Pravin B Shelar 2013-06-17  61  	skb_dst_set(skb, &rt->dst);
0e6fbc5b Pravin B Shelar 2013-06-17  62  	memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
0e6fbc5b Pravin B Shelar 2013-06-17  63  

:::::: The code at line 55 was first introduced by commit
:::::: bc22a0e2ea03b75b51a1f722f93821744b5b5ff1 iptunnel: make rx/tx bytes counters consistent

:::::: TO: Nicolas Dichtel <nicolas.dichtel@6wind.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 84dce6a..f25ccea 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -54,7 +54,6 @@  int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
 {
 	int pkt_len = skb->len - skb_inner_network_offset(skb);
 	struct iphdr *iph;
-	int err;
 
 	skb_scrub_packet(skb, xnet);
 
@@ -79,10 +78,7 @@  int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
 	__ip_select_ident(dev_net(rt->dst.dev), iph,
 			  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;
+	return ip_local_out_sk(sk, skb);
 }
 EXPORT_SYMBOL_GPL(iptunnel_xmit);