Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp724552pxb; Tue, 2 Feb 2021 16:47:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyhmUhI7Mr/YMOkEI7XyO5biVuRq9OGK7LernS8fIR7icbPCbDuc1fseyb2UDtk0OQKjYM X-Received: by 2002:a17:906:7e42:: with SMTP id z2mr597558ejr.177.1612313224827; Tue, 02 Feb 2021 16:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612313224; cv=none; d=google.com; s=arc-20160816; b=f7l2ruEP2+XwR66apEsRmZgJjip1b4Rg+SZ2iP/obGK9AGxjlJ896C87pGdP2AKwHI WCcpC1dAgOTbfR4LQ8fIZPdt1n1px98ml2Ip2rObhLM4810k/pCQQdH19VXr4gmfVvE8 IZBUSXU2QHLEM2TvopzQqop3pTVATkHYEBTYrybP91xrs0My0X0j65WUvqs0hPv6gRzA DK0iaPa4mEjiF+0aVlVKKXDvSk6G8uXnizWTKE2eDzHgPBUnbHabsokK5WRjnX4ZLFPU KNFCY6myNwk9WSmJ0mXNCzZyJGXqMB2VW3U5D5JsnRSYw/AH5eIyQ1coF34fXPqGDj+z LxFw== 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=sZmFx7H9Oa2pXfZExvPW6+c/3RI5Ppqp5to+vZNmISM=; b=wUlgOiN/KgsHSSbzEhb16zibGXnLnnALuUwmKCntQWlYkrIQOHvrYhlaVbt2QfL9XS IIh4kbloVMU39roSPd4TbLbxqxeplG3ECHOg7jy+i+I0JN38oklRhbvVDI/85T8B6XWe GBxZ6sVGsaix0UNODcxP9DB+tytw9tJ3tBuSlqiN7vsT+EzFtlvwSSILKds+0bYWdaCk jCugjBtT2Hqj0BbCjS96MviavsPYh54Z/htACDPHmShfEmsWS+Uii5GIcG5U976tUJ4y D7WfPJFi/KXabEw4Fris/XYrY4n6UQsV4+lvHEIRKgIqk8PEQVsvg3T5DSl+Eoxv7lHw 82aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LSRe9KLN; 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=pass (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 g1si285498ejz.557.2021.02.02.16.46.40; Tue, 02 Feb 2021 16:47:04 -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=@linuxfoundation.org header.s=korg header.b=LSRe9KLN; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233557AbhBBTcX (ORCPT + 99 others); Tue, 2 Feb 2021 14:32:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:45152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233471AbhBBN5b (ORCPT ); Tue, 2 Feb 2021 08:57:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6035164FEB; Tue, 2 Feb 2021 13:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273555; bh=kM5zywBEu7LwcnvRmdesdDSMreCG50yX05blNA+dLBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LSRe9KLNHciLlEmyioTt80lSOKPuYHXOf+e5HbjTkUZdBpTNKOayZg0wn43/AfK16 R2eRrtYCnWdYmWD3Eust0aXEETE73CC5xozv9KW2ZGPkoqGjHPIUfUyPyjxVFdda62 GTR4MCqZt2Clz1Ul0a34uVd1xBX3DmCFjWAZnkCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Nunley , Tony Brelinski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 108/142] ice: Implement flow for IPv6 next header (extension header) Date: Tue, 2 Feb 2021 14:37:51 +0100 Message-Id: <20210202133002.167204485@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@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: Nick Nunley [ Upstream commit 1b0b0b581b945ee27beb70e8199270a22dd5a2f6 ] This patch is based on a similar change to i40e by Slawomir Laba: "i40e: Implement flow for IPv6 next header (extension header)". When a packet contains an IPv6 header with next header which is an extension header and not a protocol one, the kernel function skb_transport_header called with such sk_buff will return a pointer to the extension header and not to the TCP one. The above explained call caused a problem with packet processing for skb with encapsulation for tunnel with ICE_TX_CTX_EIPT_IPV6. The extension header was not skipped at all. The ipv6_skip_exthdr function does check if next header of the IPV6 header is an extension header and doesn't modify the l4_proto pointer if it points to a protocol header value so its safe to omit the comparison of exthdr and l4.hdr pointers. The ipv6_skip_exthdr can return value -1. This means that the skipping process failed and there is something wrong with the packet so it will be dropped. Fixes: a4e82a81f573 ("ice: Add support for tunnel offloads") Signed-off-by: Nick Nunley Tested-by: Tony Brelinski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_txrx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index 23eca2f0a03b1..af5b7f33db9af 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -1923,12 +1923,15 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) ICE_TX_CTX_EIPT_IPV4_NO_CSUM; l4_proto = ip.v4->protocol; } else if (first->tx_flags & ICE_TX_FLAGS_IPV6) { + int ret; + tunnel |= ICE_TX_CTX_EIPT_IPV6; exthdr = ip.hdr + sizeof(*ip.v6); l4_proto = ip.v6->nexthdr; - if (l4.hdr != exthdr) - ipv6_skip_exthdr(skb, exthdr - skb->data, - &l4_proto, &frag_off); + ret = ipv6_skip_exthdr(skb, exthdr - skb->data, + &l4_proto, &frag_off); + if (ret < 0) + return -1; } /* define outer transport */ -- 2.27.0