Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp406844pxb; Wed, 3 Mar 2021 06:22:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUlIHZvmFJKTy0eAX54tomaHFWJTVCajmaC7zMXpKqN35ThORqou5x+/gevPXZDg9MVVxI X-Received: by 2002:aa7:c450:: with SMTP id n16mr9958892edr.16.1614781360645; Wed, 03 Mar 2021 06:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614781360; cv=none; d=google.com; s=arc-20160816; b=EFJlbk85PerK2sH/HTRDVs036bxLNiOpIeTSHA10EnEAAcCDby7Tgh/+g3WCkEEaQE ERI8RZH0ZUOvGm0jugkRxwL2vjkTPJoCBXD59dOoEfRBm8i5aCquk+7Oyk9D65ss5QaN 5gc4o/j36NHjHlL/rJU0V4FDGG/+35x+/vnftM6r+tJzQ3ZYTwdbGNQpPDB5tKKAYoka 3obOPbNxB21DoIASJ1WVrP/kwAZ3HXtlQKJw2WG7RqxXjO5MLWYD0v7epUJc7iXtS6p+ EwrUSKFYb23idA+CUhmCZAf2FzJMKGcOowLVdif6RM8VruqVF2shR9OtaJcnSgUDewiJ kpLQ== 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=OH2Z+7A02xRbplOTy80/hBTKuGeRVqLbbm04VIHZCao=; b=DUU+PQF00QqyORGWeZ1qgnw/peNkp14qXo/wweKSdBpg8WxUu7G1keX8cgrbNrGgEm 8+YgJ4WYcsTClnZCK8Jn7y1K55KCvo0lsHTNYf74qPWNadBSt+++Rc664vutqNK1F5Mp A4hTpEPBzM8nHi+Kmw9Ru6WVo3dlQZ8DjQvWtk0SR9Ns130TtSsdr7mA3mh9SyVcl8LP +UNpLatsrzBJM5nLtvGkR1e4MQQ1UKMyHN/2V3ePhP1aCWpZF5/SiDnN/cQ2uBOtrd+k DyAJLCgxxHbyn0eCuqRVAOdwdPsJlCZdIvfcjZkC9iQKw1Kain/jdmWd9AEqiLeTTh3d qwdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QnPm+xyZ; 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 y10si16017488ede.335.2021.03.03.06.21.42; Wed, 03 Mar 2021 06:22:40 -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=QnPm+xyZ; 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 S244098AbhCAVIx (ORCPT + 99 others); Mon, 1 Mar 2021 16:08:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:49744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237846AbhCARNe (ORCPT ); Mon, 1 Mar 2021 12:13:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 98A1B64E56; Mon, 1 Mar 2021 16:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617069; bh=KSf82lTJOsAR86YB5kyc709rvTXQfXjMCYfqyKK9f4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnPm+xyZPxkpv0/q+qp0Q3PU0974dP1/mdjP6uCN2U2lxthZ8aiySpmRG+sjjwYPR 5I1DArwuH8ZU+4gyUlQIjeOe2rNw6yAOAyVq1ltY+skPTkVA0mLiQmFoxXZx7oglUL dZN/Ssp10P1MVRZulzFHu0rMz5uAkOcXmrRphl18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Slawomir Laba , Przemyslaw Patynowski , Aleksandr Loktionov , Tony Brelinski , Tony Nguyen , Sasha Levin Subject: [PATCH 4.19 162/247] i40e: Fix flow for IPv6 next header (extension header) Date: Mon, 1 Mar 2021 17:13:02 +0100 Message-Id: <20210301161039.596142543@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@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: Slawomir Laba [ Upstream commit 92c6058024e87087cf1b99b0389d67c0a886360e ] 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 I40E_TX_CTX_EXT_IP_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: a3fd9d8876a5 ("i40e/i40evf: Handle IPv6 extension headers in checksum offload") Signed-off-by: Slawomir Laba Signed-off-by: Przemyslaw Patynowski Reviewed-by: Aleksandr Loktionov Tested-by: Tony Brelinski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index b5042d1a63c0b..9ccbcd88bf1e6 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -3070,13 +3070,16 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags, l4_proto = ip.v4->protocol; } else if (*tx_flags & I40E_TX_FLAGS_IPV6) { + int ret; + tunnel |= I40E_TX_CTX_EXT_IP_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