Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2946170imm; Mon, 10 Sep 2018 08:40:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFn9pBQzUMT7MTF8cjxfo76ea3zO9xH454/MVJXdUbCVX7GeLeY5TIAgfe/sKQxT/LFLH7 X-Received: by 2002:a65:60cf:: with SMTP id r15-v6mr23596053pgv.41.1536594053010; Mon, 10 Sep 2018 08:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536594052; cv=none; d=google.com; s=arc-20160816; b=L7LuGCiDG9Xz5NwB3PjCZlJYJsKb7VZutSyop81E17nAhCFbPcihKH2zyHPn3ZZSV9 8sl6xZwXWlMdz7pPaxkz4zLoIuOQOvofBHcXP08YnLQMPXnhlVojX6Bf9UP23ycN5BTv mX6CjGZqTWxey4wVBZkHRLRGPqW+1hM1cKEHjpwY2RcXRpFXey90HKt7oRjIS5hMqfLA fqmxPM44znWIDTrW7IqUHQh4mcS7S6iIP7LxD2PFG8vMd3GKDnCl6ve7EccmTSYVy+pu yPfS4jXmriOTFOmpBQ2Xomf6ySy74cIWbunqJyjivGFT3hpWckKnBCivIwmLJS8N6rNG 1R0Q== 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:message-id:subject:cc:to:from:date; bh=gltBjrt0kuyf86LD8t0j87ZLfvX0hVsIxIzMcYDdbeA=; b=WFNKO524dmiaqMMwxMLlWPJRxOhOayHd/7FxK4/MT3IP/Kn8MyoYkbULFgk+ZlG1Co qxDpuK3Y8rrBIPiHjDjLhLq57GB5cKgz+AJEZe462JofF9QSd3GoDVSqc/8wx/Rwy3HG r+1MAw7B4DIof/Z2w4HkqZ3vs068E3KSMRxPpWqT88yDd8QVEUPor3opu8pouSVnOFoP rzj1RnVai6fcrqbEs89VgbdFcpCbxWetToZ+iHyUo2xDzeXoTBoUAlmtu/33cG1q19mZ mT9zqQs5I4CpTjVt+U8jf4OBeIV8EHyE6iImhezOenb23n7tX67a8qzOS4TCYWnfgclA Y/dw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cc8-v6si18561289plb.69.2018.09.10.08.40.06; Mon, 10 Sep 2018 08:40:52 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728453AbeIJUbZ (ORCPT + 99 others); Mon, 10 Sep 2018 16:31:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44834 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728043AbeIJUbZ (ORCPT ); Mon, 10 Sep 2018 16:31:25 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78C2B40241C4; Mon, 10 Sep 2018 15:36:45 +0000 (UTC) Received: from localhost (ovpn-204-175.brq.redhat.com [10.40.204.175]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 458862166BA3; Mon, 10 Sep 2018 15:36:42 +0000 (UTC) Date: Mon, 10 Sep 2018 17:36:40 +0200 From: Jiri Benc To: Haishuang Yan Cc: "David S. Miller" , Alexey Kuznetsov , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ip6_gre: simplify gre header parsing in ip6gre_err Message-ID: <20180910173640.117bf42f@redhat.com> In-Reply-To: <1536567909-25089-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1536567909-25089-1-git-send-email-yanhaishuang@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 10 Sep 2018 15:36:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 10 Sep 2018 15:36:45 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jbenc@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Sep 2018 16:25:09 +0800, Haishuang Yan wrote: > + if (gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IPV6), > + offset) < 0) { > + if (!csum_err) /* ignore csum errors. */ > + return; > } gre_parse_header stops parsing when csum_err is encountered. Which means tpi.key is undefined... > > - if (!pskb_may_pull(skb, offset + grehlen)) > - return; > ipv6h = (const struct ipv6hdr *)skb->data; > - greh = (const struct gre_base_hdr *)(skb->data + offset); > - key = key_off ? *(__be32 *)(skb->data + key_off) : 0; > - > t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr, > - key, greh->protocol); > + tpi.key, tpi.proto); ...and can't be used here. Jiri