Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp740002imm; Fri, 14 Sep 2018 05:44:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaTOIMvNTqAj+ESbxCaf+iVrAWQlwGkSnoZgVj5rzhkAjzm+t0gX/SkU3ilDKhJMh3s8sjm X-Received: by 2002:a17:902:e088:: with SMTP id cb8-v6mr12093764plb.189.1536929099796; Fri, 14 Sep 2018 05:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536929099; cv=none; d=google.com; s=arc-20160816; b=knWYWDq683H7pMFR/UG6bj7SIITINp1EZ3uBqQk5h+Nhb2+6eoOSSyrKvYxW656hW3 3OErX2PdYYx4ErGScxyshFUFYfcG1vq+NF0cMux6eOf1F8c0OKaFtc7Qx9bvwjeepg40 Yn2XO0z3Z/RqI6Kkr2hdECR1c+hMpZAUBhYomHx2Sk8MiBfPeQKVTPI9OV+/S8B1IEuz FG+7DqCK93iRFpZQgBtvBNz6gZJB+1Z9X8CCHBo4+QsOn/HFRuEKDf7FHFnUb+k0oV22 +YZYxqMmBlFA/hJ5YiK+pXWBxIg477exv8tAoWL8TqzL2wk6XGCo0W4sV3eJWASD/6Tc yQ4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=7W2pVijWRPvdIalEBtPM/lbCJyooYJazrNZ9XQNGeEc=; b=vG+NvoC26nN/81Kjf4s9vvfbt9Q6odA8zQODcvlB/BJERhvpbR1N/rhRVC0ldUBd2V h+JQh8yjkS5zLgEQaCD6yEXCNOWfV6QjrpXl4kMOdYla+JjbbjqFMb7gCz6efqvxKfad b+Z2SU8cMUXZAnDp4Mmp2/hCnh8Nd/wRkPlGnxA4gC4DMPpBEz7Wezd1hsC9LJLshYJb 7Nq+3CkbnKK+O78mN2msW2qcLuctO+g0af3ZHIHkc53UCoP1XogrJooC/T6lRnnreBZr t60RywEioBY/GJ+RLqAQ0vsfcvd19RZVPGeMLskwFO1dv1ESFfii+hCP8mDIF5nZHSpO q1Jw== 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 q28-v6si7187129pgm.689.2018.09.14.05.44.44; Fri, 14 Sep 2018 05:44:59 -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 S1728201AbeINR6b (ORCPT + 99 others); Fri, 14 Sep 2018 13:58:31 -0400 Received: from dispatch1-us1.ppe-hosted.com ([148.163.129.52]:46988 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727841AbeINR6b (ORCPT ); Fri, 14 Sep 2018 13:58:31 -0400 X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 4C160B40061; Fri, 14 Sep 2018 12:44:10 +0000 (UTC) Received: from ec-desktop.uk.solarflarecom.com (10.17.20.45) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 14 Sep 2018 05:44:07 -0700 Subject: Re: [PATCH v2,net-next 1/2] ip_gre: fix parsing gre header in ipgre_err To: David Miller , CC: , , , References: <1536744082-3568-1-git-send-email-yanhaishuang@cmss.chinamobile.com> <20180913.105840.140151724801067072.davem@davemloft.net> From: Edward Cree Message-ID: <4bd44714-8190-feca-27dc-6f6b254341f8@solarflare.com> Date: Fri, 14 Sep 2018 13:44:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180913.105840.140151724801067072.davem@davemloft.net> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: en-GB X-Originating-IP: [10.17.20.45] X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24094.003 X-TM-AS-Result: No-1.265400-4.000000-10 X-TMASE-MatchedRID: 5+1rHnqhWUQOwH4pD14DsPHkpkyUphL9f6/Md8Lb2l8S+jFO7d+PWxFh ASIm32ESIHvHLq6y9SYlGDdg0lZZyQXIgwc8UuR+84dsinZ5e1jljSRvSGpq3AagDhBTr1Yko8W MkQWv6iUD0yuKrQIMCBBWOoA5nlyNC24oEZ6SpSmb4wHqRpnaDur/VFDZgUnZ9dvopdtgvRyAgP AF3UgrsdqRClEwTKdsF/FpD8YEv2sEOgskqdAdar0IdXsJVoXCzXb/lfI3yCfSsUr1Ig/KbYfMZ MegLDIeGU0pKnas+RbnCJftFZkZizYJYNFU00e7N+XOQZygrvY= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.265400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24094.003 X-MDID: 1536929052-ERAb9xKpOvdN Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/09/18 18:58, David Miller wrote: > 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. How about just reversing the order of the AND? if (skb_checksum_simple_validate(skb) && csum_err) { *csum_err = true; return -EINVAL; }