Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp348298pxj; Thu, 20 May 2021 10:41:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYnZ3PqUn022CfqSdLD06/F6hv9jqw7v1AqBMyRA40Rf8J4X4uzA497XBEelxaJNO7ZDrp X-Received: by 2002:a17:907:2ce8:: with SMTP id hz8mr5837049ejc.464.1621532472551; Thu, 20 May 2021 10:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621532472; cv=none; d=google.com; s=arc-20160816; b=d4cs8oLnfBLRUP2c5V/lnTU6LB+SBBK+xiQR4zEJdZ7uxzZ7/oouFzH3MRmzyq2iKz yJx7cthQj3kB3Da0dZVXOZ/DOjsOL7T1zznl5GpxMqO+e4eoyerz4oLXaSxZk+ig0AP5 ckleYIcvwMhAv8EJ1P2m24zMBHWQNqU5IxHi/G8kP/0xmmNW5HqKB411i/h0sxXDRmUJ OBwnmBVe9CCYypGo8Z4XFYWnHG/NlGDxbCvcaJINpip1ppSaFAwl0KuPaLw9+me9GO0U knBQo0/HLsSb+TIj3t+Iuf8wnZ4JpRll3V8n1dIOpvFgWzBRKDB/1oGdONyRFP4uUiQ3 wOvA== 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=mQul7t11LRwLZUwYySWCekIUGC+GaINFhvV2JwAm0dY=; b=GQ3/Cx1dwMbkwYX26fAb8EHNAcBxC/txfwjHZHQ624hDu8QRBH8K5y09mHiwg4MY+f LtrE7UXT6zdkMTRG5ZGZ9P12DkDIIvXTskcd4+WUvyTg9z7+kD9qMC8O75GMBxnswF4L vqS+5KmbLOSAPK/okGOVsUlABZNI4W9OvliXMDKxq08YplEUBez6wnK4Pvrwl3N6G4Wj vbZZv3hHGHRX5XBUlmaiSE5y3rswITlofIcREOUHwofgt/oZMgZBGj3648k3ZHdObUme MLrE7/SrES+1Re/vjPWNCGJVOpDRnhLr/VPn7lO86IsqMhzMcIlxY0dw9AAuqWq003hW MucQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Umtl7S7b; 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 js19si4164615ejc.277.2021.05.20.10.40.48; Thu, 20 May 2021 10:41:12 -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=Umtl7S7b; 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 S235630AbhETKJG (ORCPT + 99 others); Thu, 20 May 2021 06:09:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:35472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235127AbhETKCY (ORCPT ); Thu, 20 May 2021 06:02:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F20F961878; Thu, 20 May 2021 09:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503588; bh=MsAFQamvFrMBG8qV/sbvQbn9DC83iXFqyufTLuu8Ei0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Umtl7S7b9O96+493qIKGunj6+0hSAcr66i1mDI4v4V1pDT+fv2CEtHvzLOiNDASMz RrlZ5BYvXXaL+fjQP2MDTzFvEZist6XAkyUEq4B4nBZQ4CF7VZa/44ExAuENQU+0tw 2HXC5Pn0tHS0scxKuVzDL7pSAdcmzeuLporcbBSE= 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 4.19 288/425] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb Date: Thu, 20 May 2021 11:20:57 +0200 Message-Id: <20210520092140.908128177@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 ce6fecf421f8..8c458c8f57a3 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -839,7 +839,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, __be16 df; 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); @@ -885,7 +885,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