Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751513AbdFFPfU (ORCPT ); Tue, 6 Jun 2017 11:35:20 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:32944 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428AbdFFPfS (ORCPT ); Tue, 6 Jun 2017 11:35:18 -0400 Date: Tue, 06 Jun 2017 11:35:13 -0400 (EDT) Message-Id: <20170606.113513.1622122258709494887.davem@davemloft.net> To: yanhaishuang@cmss.chinamobile.com Cc: eric.dumazet@gmail.com, jesse@kernel.org, kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sit: reload iphdr in ipip6_rcv From: David Miller In-Reply-To: References: <1496558623-11437-1-git-send-email-yanhaishuang@cmss.chinamobile.com> <1496667813.5031.20.camel@edumazet-glaptop3.roam.corp.google.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 06 Jun 2017 07:53:39 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v56FZP6f030417 Content-Length: 1387 Lines: 42 From: 严海双 Date: Tue, 6 Jun 2017 10:09:45 +0800 > >> On 5 Jun 2017, at 9:03 PM, Eric Dumazet wrote: >> >> On Sun, 2017-06-04 at 14:43 +0800, Haishuang Yan wrote: >>> Since iptunnel_pull_header() can call pskb_may_pull(), >>> we must reload any pointer that was related to skb->head. >>> >>> Fixes: a09a4c8dd1ec ("tunnels: Remove encapsulation offloads on decap") >>> Signed-off-by: Haishuang Yan >>> --- >>> net/ipv6/sit.c | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c >>> index 61e5902..af832e7 100644 >>> --- a/net/ipv6/sit.c >>> +++ b/net/ipv6/sit.c >>> @@ -657,6 +657,7 @@ static int ipip6_rcv(struct sk_buff *skb) >>> if (iptunnel_pull_header(skb, 0, htons(ETH_P_IPV6), >>> !net_eq(tunnel->net, dev_net(tunnel->dev)))) >>> goto out; >>> + iph = ip_hdr(skb); >>> >>> err = IP_ECN_decapsulate(iph, skb); >>> if (unlikely(err)) { >> >> This seems unnecessary. >> >> By the time ipip6_rcv() is called, we already have the guarantee the >> IPv4 header is in skb linear part. >> >> Otherwise we could not use iph->saddr and iph->daddr in the call to >> ipip6_tunnel_lookup() >> >> Therefore, the pskb_may_pull() is a nop in this particular case. > > Yes, it’s right. Thanks! Ok, I reverted, thanks everyone.