Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4567331pxj; Wed, 12 May 2021 08:20:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK9YLhr6PZe43Q3OXds69gyeeZQ0PPR/B5qZx8tB9HLbO87jEKzsNMz4toOrQEB23tJUeu X-Received: by 2002:a05:6830:2117:: with SMTP id i23mr30759203otc.170.1620832828454; Wed, 12 May 2021 08:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620832828; cv=none; d=google.com; s=arc-20160816; b=Cf70fpydgvGyIiPZ8BRaHnnm6F9orCfAFtRbnQMYZmiC3FTDm3G2huGEt0pHcH4kdD a8jxTwOjqkWnMZ/KM7iiwnO0mxIbmN7w+kRuVhIxN6hmpzmhg+NgzEKn6fF8FMAu/B3K e6xhR0kiY1TK+RpQ2ulNSKtXP80y/PZ4uZyRdRAiN/AYupJ+kQP7YBA3EjGenKLhX7FR W+iyDukF/oY8Yf46PMwuQgy7NWDCYySfBU51KO5Cwuu+efZVX8VJEV+PuljEDeUhOn+p lalBIRzGEwPQH7LFbVKXR5/zFheVgW7nSm5bk/HDPLulWvv9ATQUB2+nBAgsIGArNq8p prDA== 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=KeJ86xeeEKRg8M/c2C6dBvYTfHCHV5yNFdx2a1kVwoE=; b=sCQ5Otu0YTd+2TvFcqqs+UMbF4WBwJoA0AwafvWCAWetwVyTqGUycNt4RkZYbOau5J CoYNDgxeLAwqqtzRNEAcDw6jMKRxp7/dmPci+R+8btVG6K2Fh8htU7rQc2+1KqtCuxWH 1aMIEn3N0HjYSyQVb4e/UIsX3Gv7sD/vYarM+pWPSg5KNjzYo3upv9C7fGl3c1OjphuS 0r58tuDh5V6R2F0x+M5hWScOhuF5F6PGQpWsCNDpbRPGrI7UhthxKluYaWdg30kPKgOs p1iQJqp+v8EDscjQH85DdRJu9MiARn149qsF4qFvwOHLW3xfeoLMg9f77L+MPVPJR8HD xjuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UpX8iJ/g"; 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 c16si146048otl.33.2021.05.12.08.20.14; Wed, 12 May 2021 08:20:28 -0700 (PDT) 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="UpX8iJ/g"; 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 S232365AbhELPR7 (ORCPT + 99 others); Wed, 12 May 2021 11:17:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:41216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbhELPIV (ORCPT ); Wed, 12 May 2021 11:08:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 370A3613DA; Wed, 12 May 2021 15:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620831711; bh=nCsTnRZ7xk8O3YzpwcXbOus5TSkKf1zqHQxlE2U9JuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UpX8iJ/gVnESdoG9T6WS7fneD/tIsEZijd97nf2WU1AWqL3elJEPHYaPgi3eFrSq2 KRvE78y9uDXBSagQWLlGDTR1R4tQOw81aUxuMb/ZizsGtpWTx8A24htpq74wNFA9ZH iHn5KY3hmO5McLSWAj2o6CEto1finUUV1D8++AYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Sabrina Dubroca , Phillip Potter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 228/244] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb Date: Wed, 12 May 2021 16:49:59 +0200 Message-Id: <20210512144750.302405027@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144743.039977287@linuxfoundation.org> References: <20210512144743.039977287@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: Phillip Potter [ Upstream commit d13f048dd40e8577260cd43faea8ec9b77520197 ] Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes two kernel selftest failures introduced by the commit introducing the checks: IPv4 over geneve6: PMTU exceptions IPv4 over geneve6: PMTU exceptions - nexthop objects It does this by correctly accounting for the fact that IPv4 packets may transit over geneve IPv6 tunnels (and vice versa), and still fixes the uninit-value bug fixed by the original commit. Reported-by: kernel test robot Fixes: 6628ddfec758 ("net: geneve: check skb is large enough for IPv4/IPv6 header") Suggested-by: Sabrina Dubroca Signed-off-by: Phillip Potter Acked-by: Sabrina Dubroca Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/geneve.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index c33a08d65208..84f5717c01e2 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -891,7 +891,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, __be16 sport; int err; - if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) + if (!pskb_inet_may_pull(skb)) return -EINVAL; sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); @@ -957,7 +957,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, __be16 sport; int err; - if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr))) + if (!pskb_inet_may_pull(skb)) return -EINVAL; sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); -- 2.30.2