Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3199902pxb; Mon, 9 Nov 2020 05:26:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJylMKHiskKm2aJNV4abUt2AltpVCmT6qItypI/TYIDP2bYqVfcvR6xDlOACgHaIgY0Kttcp X-Received: by 2002:a05:6402:54c:: with SMTP id i12mr15894924edx.9.1604928382858; Mon, 09 Nov 2020 05:26:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928382; cv=none; d=google.com; s=arc-20160816; b=W/92FcVax4ne0iRCzw0l3797hT51lrg/1U9DsDN41pfgOil7PROYiQvEhX5Ehx3qYM 7A6QswcZegK613my+3FQ8YYp56VrEb4F6wo1Zc0vVN8FsYejxXWMOc56TUOWjKeoT/HM XIsuiNoJaXgYQo0PxWgKhemar+vK+q7jM+A1OcEYtevh/Y/Qmucii5A09mFjEkL/wlew NKj/nqxOtvEbHVWz1d07WFOsJ8VhoAJcnFogdBj0sqKQJ51J9RVvB/zwM3CvXNAcoOWY CPqC0iIhq0cCONxCOR+NNFDFKsY12KT9UeML4bTLx7gHA/XeRwKXv7tAH/Inub68UVl2 8Tzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BVM0gAdWVlk5VRjJZWOEimB3dG6wD+WmRZZ3qgm1+g8=; b=icxu5+rqjCn3xlHJSwzYCnwlHBsIe09sFwZOkzHDq1159+kn4PgLUdLNlJjwkBEEua HF27PtVPhyBrKKNT6nNHBBDez6mr7YVju7kR/mkkX2dg6q6CjGlJn7nmAt28i+2WcjIt N6hlZ4hDpbSWxHgXjhmlTwKf/uEMhgJdJO+4uuBcLNxYlYdydndYDpsqFDe6xieXbDGd gkiWJ2ZTrUNgovpaM/9CkV4OE6Txp87NMgMAFl6gWE64iY7Qey/1ODkBqiJvM7bu0Ri3 rCyKnX9ySXjAnSfx4mRNSvRiLwR4OpW2EYUlP2kBPC7eoW85FDLslas1v5+YGGiMbWp1 6PQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k0ZdnGgs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di3si6725151edb.554.2020.11.09.05.25.59; Mon, 09 Nov 2020 05:26:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k0ZdnGgs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387820AbgKINYm (ORCPT + 99 others); Mon, 9 Nov 2020 08:24:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:46054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733301AbgKINSo (ORCPT ); Mon, 9 Nov 2020 08:18:44 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6606206D8; Mon, 9 Nov 2020 13:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927923; bh=L2V8POW7BWB/ifqq4z9lxumBZZbLrKbTyY5mf+3pfwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k0ZdnGgsRU3Zel4oowy0Yc8btkeZkH3dKv5IqEgYl/nIM2GvATKf441CoY8hKtcFM j3BQKHKviGSbJS1Jxkn3ikB/85aJovMT0HscrvE4OacCyOnhQNCHGK3ebjm1QR+r/W +wpmzz5jDuwFzj4sy5DbP3g6MUw/0nVKfpP9dhiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Ovechkin , Jakub Kicinski Subject: [PATCH 5.9 037/133] ip6_tunnel: set inner ipproto before ip6_tnl_encap Date: Mon, 9 Nov 2020 13:54:59 +0100 Message-Id: <20201109125032.497762895@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125030.706496283@linuxfoundation.org> References: <20201109125030.706496283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Ovechkin [ Upstream commit 9e7c5b396e98eed859d3dd1ab235912a296faab5 ] ip6_tnl_encap assigns to proto transport protocol which encapsulates inner packet, but we must pass to set_inner_ipproto protocol of that inner packet. Calling set_inner_ipproto after ip6_tnl_encap might break gso. For example, in case of encapsulating ipv6 packet in fou6 packet, inner_ipproto would be set to IPPROTO_UDP instead of IPPROTO_IPV6. This would lead to incorrect calling sequence of gso functions: ipv6_gso_segment -> udp6_ufo_fragment -> skb_udp_tunnel_segment -> udp6_ufo_fragment instead of: ipv6_gso_segment -> udp6_ufo_fragment -> skb_udp_tunnel_segment -> ip6ip6_gso_segment Fixes: 6c11fbf97e69 ("ip6_tunnel: add MPLS transmit support") Signed-off-by: Alexander Ovechkin Link: https://lore.kernel.org/r/20201029171012.20904-1-ovov@yandex-team.ru Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_tunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1271,6 +1271,8 @@ route_lookup: if (max_headroom > dev->needed_headroom) dev->needed_headroom = max_headroom; + skb_set_inner_ipproto(skb, proto); + err = ip6_tnl_encap(skb, t, &proto, fl6); if (err) return err; @@ -1280,8 +1282,6 @@ route_lookup: ipv6_push_frag_opts(skb, &opt.ops, &proto); } - skb_set_inner_ipproto(skb, proto); - skb_push(skb, sizeof(struct ipv6hdr)); skb_reset_network_header(skb); ipv6h = ipv6_hdr(skb);