Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4632065pxj; Wed, 12 May 2021 09:39:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPerhX1PYKQcFIvvfp7PzIHqom80b4VQ8owZCLWVWNhNQ7lmSbmPm4+7+cbn9w1v3mI+x+ X-Received: by 2002:a9d:6255:: with SMTP id i21mr28089046otk.284.1620837435905; Wed, 12 May 2021 09:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837435; cv=none; d=google.com; s=arc-20160816; b=PxLWV0WiYWHX3nZpigEPxUW5BPpxdYrEyQOn0/oa8JXm4Qfb0Uqc4fsOFadtWfy32I tSTVb9P7bTACZSc6k/0rDrMq09qrJkWM2GiHl5r4ofUC+PRTNMY3SbXz21LOd7aHRyJT /9IjMl7zKyK/BSFPQy8/fRyRXrvgeVyDqThwgblnAXfVhifSfGNdYrcu+xDVU6vQCJSA 1Nr/+0Of/FRBtiJAnvDjc4aqhh53Dbj6b5Xo9X4o9a/U9bl6UDfTPUx2z5XLRGONjtFK 3uKJ/5PRNbW8RZ2+B/tLqhWMZG8g+UCaxryW3GROYgAmtypJ2HYU8L+uucl0D+d2ONRC j68w== 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=RzrNKoliLEVcO7MBJ0pFVtrm5bfEuoeArDjsytjjcqI=; b=AlvZp74MdndoVoqC94Xrs4rLOsj22uWI/0fex5N8khuNlRSZa/N3CatnWIoT/wI5nA IIGVhhPBJLuDtYxIkW8A76eA6Bpq7/uJ1kOsmY0UlS8PPOyMHW7wFlJENIVZL+LBwNb3 FviIC7LMhdr5TV/ezQOg3Gc3lP/YDRbp5qQWc3azr6lfXpH+tbW+6yIvDMoQ88zwVTK/ 3AQS+h3cCXMx2efSII88efPgko1UuyCeyRnGBC4tI6Ua15oZ49eVLBqK0KSq7d06Apk7 bhfKhvHlExQfm7xI93BLPDSDtKim5R7I/19ZwZ59HR5CcBp63k9GJ7JlEVY3Y71LYy54 rmXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TtXGgbwF; 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 o203si452589oig.131.2021.05.12.09.37.02; Wed, 12 May 2021 09:37:15 -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=TtXGgbwF; 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 S243068AbhELQgh (ORCPT + 99 others); Wed, 12 May 2021 12:36:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:41108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235449AbhELPo5 (ORCPT ); Wed, 12 May 2021 11:44:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CC74E61C94; Wed, 12 May 2021 15:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832974; bh=KSkxc4yQuCuO2LxouqwKGdsmrGzoxYGInR38xFfG8zI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TtXGgbwFrrgAFHy0ubKmLke2dA2p6XVenQnKxZryd2J2vnT2T6jGd4fS8iNQjffh7 QP498dQ0IylG+QjRL77sHpgBUful4CComY3aLSTXen1E8s145kXXdZhwd7AhOSnFGI t0uF1FfBGjFpGQlSrlQgLlV8S5zsILZ+Y/aB87sU= 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.10 498/530] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb Date: Wed, 12 May 2021 16:50:08 +0200 Message-Id: <20210512144836.127088530@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 11864ac101b8..5ddb2dbb8572 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -890,7 +890,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); @@ -987,7 +987,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