From patchwork Thu Mar 22 22:07:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 889680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="DgKv0VXi"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406gsg1yBpz9s0y for ; Fri, 23 Mar 2018 09:13:11 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5A43FE38; Thu, 22 Mar 2018 22:08:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 71BDAF00 for ; Thu, 22 Mar 2018 22:08:05 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 32CA5360 for ; Thu, 22 Mar 2018 22:08:05 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id a11so571959pff.8 for ; Thu, 22 Mar 2018 15:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o0IAZXxPezu02FAmKNTbHxCOjXC7LtR1gnmbEXgG4Xc=; b=DgKv0VXiTnV+grpA1PuLagOoGWcIz3455+rEcx6tNdxFIivy41gklfbL0Ds+56TmjY I6aKeM4jOCEFpec7WOCEsBfPFKbfY53HmaqffTC4q++A5qfBtzGV8IfoFOgqvi4ZTxYS oWhp5Mo44XOE0CNK6TZIxxdKpg1YuYhLTxcpIH+h0ywmyJ3XRQ8tCAbUr9N/1JGS5l7c /RVfPf9i9yzEQIaRABQOaNiJCH5srF8SYg4T6qXJLPYxilsu8FeO/3cKTpwp3Ykbx/EW gARvlNXw68ADra39e6MhR5Ntfp9207MBwY5HmLVDKurtGwwAuUV08GsqD5nxGE6auNYX 8PAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o0IAZXxPezu02FAmKNTbHxCOjXC7LtR1gnmbEXgG4Xc=; b=sbVjyXvEltu/agyc8sirvLziqzabOZH1B68EehNmnplkEg1K3Hiu/YwubZUVGo6mnB Obur+Jwh5iUGlsTqzwBjaX0t2Pucj/IGL4FoFBeS1Yl9zLvAxezxHFsWMqKITmdE5JE1 KB8VPG1Wfpxh+bgyemtfrmJVYHuRwkt5jqkNfXy2xJ4AM3Q7o2thIWWYseP+FaUN+12V //SBKLKN8dNZQF9XERVtoj2Ohguf+y29OvfaHehTRJov2KIO+YA8BMxKFbgXFThryYA2 nWNv9JkqfXXUB/NGnNmWD+C1uT6zfy5znoG0v8JprpuPNhgivNfr3gcmPFaLJqiw8kAZ h6Pw== X-Gm-Message-State: AElRT7GqLlfRhuHVO8HXHElzf90hYvv6g9spSJi3/6gM/Q0IKS1AaDqh DWTvRAwt/+5l+Gp3oHXTSQe+nQ== X-Google-Smtp-Source: AG47ELs5BXJmw9ijlA9SRNl1GjxzojJI7QWeBbN/Qz6ubU0dLBjG50Yeg91Cu2hhd6QbmUNoTxAVbQ== X-Received: by 10.101.97.15 with SMTP id z15mr17179733pgu.393.1521756484367; Thu, 22 Mar 2018 15:08:04 -0700 (PDT) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id 4sm2280775pfn.32.2018.03.22.15.08.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 15:08:03 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 22 Mar 2018 15:07:28 -0700 Message-Id: <1521756461-3870-13-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521756461-3870-1-git-send-email-gvrose8192@gmail.com> References: <1521756461-3870-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [ERSPAN RFC 12/25] ip_gre: erspan: reload pointer after pskb_may_pull X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: William Tu Upstream commit: commit d91e8db5b629a3c8c81db4dc317a66c7b5591821 Author: William Tu Date: Fri Dec 15 14:27:44 2017 -0800 net: erspan: reload pointer after pskb_may_pull pskb_may_pull() can change skb->data, so we need to re-load pkt_md and ershdr at the right place. Fixes: 94d7d8f29287 ("ip6_gre: add erspan v2 support") Fixes: f551c91de262 ("net: erspan: introduce erspan v2 for ip_gre") Signed-off-by: William Tu Cc: Haishuang Yan Signed-off-by: David S. Miller Only the ip_gre portion of the upstream commit. The ipv6 portion is pulled in with later patch in series. Cc: William Tu Signed-off-by: Greg Rose --- datapath/linux/compat/ip_gre.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index 183b451..9863dd7 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -161,7 +161,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, * Use ERSPAN 10-bit session ID as key. */ tpi->key = cpu_to_be32(ntohs(ershdr->session_id) & ID_MASK); - pkt_md = (struct erspan_metadata *)(ershdr + 1); tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags | TUNNEL_KEY, iph->saddr, iph->daddr, tpi->key); @@ -171,6 +170,9 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, if (unlikely(!pskb_may_pull(skb, len))) return PACKET_REJECT; + ershdr = (struct erspan_base_hdr *)skb->data; + pkt_md = (struct erspan_metadata *)(ershdr + 1); + if (__iptunnel_pull_header(skb, len, htons(ETH_P_TEB),