Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4688664pxj; Wed, 12 May 2021 10:56:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5+4KNF+h8CUmdo/zpXbVmCMtcJBbB2Wh8zs4CTgyl2xM00WgUHhgpEIRx/mWHVnBFJaq7 X-Received: by 2002:a9d:6e92:: with SMTP id a18mr31747861otr.169.1620842173524; Wed, 12 May 2021 10:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620842173; cv=none; d=google.com; s=arc-20160816; b=y/8PWPgeGlfXtkmQWjphKzttViW8+AhBSok6H0N6PAWjiAdlV37bqfQDvTITRkfD15 YftD4R+9zOH+nAzUuq+ZvONcLjoPQKxCaaiDpOlmYwV8hRUp+A71rALf75bmR4KMAVPV 8NuYMwLTINAZkSBlGevXLoRe+7d8lXT/Zu9URd3s6pp5RywZBfwYk9HtqX98n/3b+438 w8vMHfLIAOBfmFFtEQHPIR7R0MXqtCFMaNpBmYXKOwJdJJe4HrpHNrumHRg6ODKizJZD Hlb47OgG9qqCMaoTfhJb4E2USEdPnACSZ66vFuv8Mqm+zHiom/kL0wz2tKa96wpqcSRC vziA== 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=d/PJ2JWTF8HaToTCaOLqgUqSrwlMLqCTk+sQCHtQ2S8=; b=SmNWAQrO7ytT5UhEMpbhoqzA/ctlJCr/b0845qTz07enaI3IPDLc4a9Whsq20nOP6N Z7/k3bC2A6Q5EmOQfqXIbhehmDbtCX/Gt6cpvcRXKvePGr2QL78wwHhA6KeBD3lKIJYV iUV0QIBXB0XmkOhhb4NP9Dj22ydKReT4OiO/rwEiSy1rMSx64irc5GdePNlHmv+hebIN ISxhi+liI3zwF4O2y8wKBUQ0AgcunaT1IXmHwD9wqHRo/O7rQt4yA7tFqPR1UF6R1C15 JIASd3nWNB29v/6Kpe9+S/Qg1epi26MyjpM140wDxJrrHXiCkHe/D6JiEyTggBSGqUKM K0Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HByk2pt2; 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 r5si514034ota.215.2021.05.12.10.55.59; Wed, 12 May 2021 10:56:13 -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=HByk2pt2; 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 S243687AbhELR4N (ORCPT + 99 others); Wed, 12 May 2021 13:56:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:36250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238587AbhELQYq (ORCPT ); Wed, 12 May 2021 12:24:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9BF20619BE; Wed, 12 May 2021 15:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620834491; bh=sNF3x2SHpTi1o1JTRJkxKOtCsZY/QCGhZ5Ung2zOL+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HByk2pt2s76IHV0curIM70Uko8wyP151Jm8oCEtbj4b17k+fayRFTVJH3q7cgQ5mO R1UsnWS6u+V5UOrc1Aqi5nZz3ux4u0ScobNesv4MkbKDBrgrvZdIChkkRNS4v93ugQ 0M5MkQfNUU2a6IICt6VaNvYAFtUSihqb2JFwjzpg= 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.11 566/601] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb Date: Wed, 12 May 2021 16:50:43 +0200 Message-Id: <20210512144846.484314713@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@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 040edc6fc560..0d8eb4a1dc2f 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); @@ -988,7 +988,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