Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1000686imm; Thu, 13 Sep 2018 11:00:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdakNhWvkf6Sl4p2FjKvRE0A/mzg613QnKmUEbAIl75wricG+ojA6UiIs2Ep6Sswul5h/IV4 X-Received: by 2002:a17:902:9a48:: with SMTP id x8-v6mr8332304plv.72.1536861627803; Thu, 13 Sep 2018 11:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536861627; cv=none; d=google.com; s=arc-20160816; b=OAYVZqhVML+tKU4pZpMNgh7E043nJOo7SKVX+uCOBFC5c77hXQDrVgwcwXFbU+jAF1 XllBTe2Kte3wBKQYO4rJN0aNtduQyC5syKVivqCvrB7StnCU0VNOFzEg5EaD3rZd0PEq q1L7bUGtyI+odH+pcnk+0l/WKCSSGUoZcXRfGyM0Pof3fBGX7bqYkgIpXl8qfqc5xMxn L1Br3H1OVYzMWIDuohqM+uIa9HFdC329CIN8IATUbY3XiJIJju0YXIWocz2FqmuouT99 o5mEq3KA0kDghIbOufWPeECHgcSfZE9Hw7hQfmpkfO7d1LBAFp7NrcXMW/Zw0XSxyEyK JlcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=bOEvZlfCdoLduyzGAn2dcqa1QMz/x4Yu52kUVaigcYE=; b=eKJYQXm3+aow9/WzVJkqhdLlKPu48EUc8nWPfW6p3CBbdQ+7nc+p3XM4Wa/Haa5pLf r637wsbhST+TrSWvlXrgMy8+eh6jIbg3wLSdD/Gz119veNiP3j6dAFJMAKwog9OJTU4x MBb7s9JE1FQptqnmbERNskLkkYzrDiFhvpyQoBlarSR/obEldKpbzA3XTXLPoz14CLtJ 0Gjo/HHy4cU86zd2PRbTPFCP9uFUPSH2llwqNmlF6nmFQR9cHekrRM0HtKJMv769DPpv BLxA/UAPbz1Ev1iF0NqeM0k1sB4iCGyneGdmS4cIor3vQ4auSobdLjLHz4l4UoEsdADL f/MA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j124-v6si4474712pfg.157.2018.09.13.10.59.42; Thu, 13 Sep 2018 11:00:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbeIMXJP (ORCPT + 99 others); Thu, 13 Sep 2018 19:09:15 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:51728 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbeIMXJP (ORCPT ); Thu, 13 Sep 2018 19:09:15 -0400 Received: from localhost (unknown [24.18.143.0]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 7A3AE1401D975; Thu, 13 Sep 2018 10:58:41 -0700 (PDT) Date: Thu, 13 Sep 2018 10:58:40 -0700 (PDT) Message-Id: <20180913.105840.140151724801067072.davem@davemloft.net> To: yanhaishuang@cmss.chinamobile.com Cc: kuznet@ms2.inr.ac.ru, jbenc@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2,net-next 1/2] ip_gre: fix parsing gre header in ipgre_err From: David Miller In-Reply-To: <1536744082-3568-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1536744082-3568-1-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: Mew version 6.7 on Emacs 26 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 13 Sep 2018 10:58:41 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Haishuang Yan Date: Wed, 12 Sep 2018 17:21:21 +0800 > @@ -86,7 +86,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, > > options = (__be32 *)(greh + 1); > if (greh->flags & GRE_CSUM) { > - if (skb_checksum_simple_validate(skb)) { > + if (csum_err && skb_checksum_simple_validate(skb)) { > *csum_err = true; > return -EINVAL; > } You want to ignore csum errors, but you do not want to elide the side effects of the skb_checksum_simple_validate() call which are to set skb->csum_valid and skb->csum. Therefore, the skb_checksum_simple_validate() call still needs to be performed. We just wont return -EINVAL in the NULL csum_err case.