Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp902986pxy; Thu, 22 Apr 2021 16:50:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx99QDBqmF7fiuQUSkcF0ZbdRlRG3xDchO7g27pJqtR9UA+c6WwkkheLRy3ULTCf2V8iL7Q X-Received: by 2002:a63:687:: with SMTP id 129mr1100120pgg.17.1619135433658; Thu, 22 Apr 2021 16:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619135433; cv=none; d=google.com; s=arc-20160816; b=qx6JjvO+1DMtdQabld5GMj90eAExL0yTBnUNCWyWD2DUk9g9PvAd5J8SuYNFvse2pC JbZzU0fNVo4deevNq9IM3M6t8TW2Y/fQG9Y+bP17x8kwLmNIvzfomEhPhSWEdJiETQOe v2MqjzFl5C9pS8H1VuXeJQQUWWe0MxVM/g8aJ6+bTRhBcKCO3EDGiCRzsUVyNXwMbwcU fi6lYB8wEu1Ui+3nIYVO0mswLwODhB96ihvdpSnJY42xcf3lh8UINvh/Qil0lFGYglGk JkeXO1GgcUhOSOtP7wx4WmMPERqFQ5NQ2AOoFxnp+gqXdL2gWVk0YF6DdHnXUXisWKLc 26tg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=NajTrN9BBqnPlsm2MhivhGmdkOA3Sl5eTlRcutI2gBs=; b=hoMXiDNDRRV91a+O1aT8DmSLjkPlYRrv9bGQjjGINGrtBGF2QNDpsbgbhtR1Sf2LsW oozbm9QIdqU0zF6I5NQa70E1TIh2OGJtpes5E5hsY5oadssVf8+8shV/BlUXmLFdSdba JOAL+guJLj/Qxd4LPT5raQddSB8XR1SC6L0vJthK3lcDSPO5pOQPvjAWAP+HqlgtRSNN 6NY6HKHc2o0ap3DCbqaaF3fu3jdl+NVqZ1s2IpD2kQc7z3MlxM6J7v2SOnFvXcquelVK tqrvq0DCyJSTfPs/AyREAp0cu2WOK8hhPhjlJuLOS9TdZeJ1tk9bMrY/820fkC0qRqz1 hnCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@philpotter-co-uk.20150623.gappssmtp.com header.s=20150623 header.b=OwGP73Cp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 194si4411229pga.440.2021.04.22.16.50.21; Thu, 22 Apr 2021 16:50:33 -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=@philpotter-co-uk.20150623.gappssmtp.com header.s=20150623 header.b=OwGP73Cp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239856AbhDVXu1 (ORCPT + 99 others); Thu, 22 Apr 2021 19:50:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239765AbhDVXu0 (ORCPT ); Thu, 22 Apr 2021 19:50:26 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C926C06174A for ; Thu, 22 Apr 2021 16:49:49 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id w4so42774944wrt.5 for ; Thu, 22 Apr 2021 16:49:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philpotter-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NajTrN9BBqnPlsm2MhivhGmdkOA3Sl5eTlRcutI2gBs=; b=OwGP73Cp/GEQx3n0coHeBrJuUFXgkDr2cIOd+hNfTBj8NACmQouNLwhsuRCVYG5Ub4 Myb3afBm2j9zSj48yCS7m70l81lSi2UEqqNb4pyo00uwrvP202Bjf+wnmawREvMZ6lcf qMQNtlMvvgGTVhFIXsuAgsrpiUIub00K4yYuMTY7clfmQH6UOQIJhOFgtQRY6x7d97fV NK05CGdS5lZDfPhv3Ccj9c8q6KFpTvwZjCRhRcfJTABficZBp5IQPdurB4tfieY3UDRq HF3m4oHHITVLwUe+HloTfnOXjrDg4U/mCpOAllIdmWwSu0t6etjiS09McE5xOfH0rc7D tlqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NajTrN9BBqnPlsm2MhivhGmdkOA3Sl5eTlRcutI2gBs=; b=R1QTzJTNI/1etNTXeGnuPBLSlH9XuPemh8WfrzgeHmIJiLmE7bSa7lNMbOvB9fCcoQ cq9EAcXZY8Eq7vxLcpkfKPREkP4Tp8dDjx6/tfxiyeObpa87yBPB+Q6ze4g21Q0I3hvQ tpfJNBZQS/hHq0rI5eEN18YDElIUgtXgcx7Aw40zptAE2EFO1YQuK3+qXJ+4nrRwW6t9 S1gO1PEDziM09PgIHFMDbCiyAX63N6T7HcFWgTdB6xKjE6uWY7lDECcgOb4GRLftxIQG J+GLIZWGVeHpPjNTqZOLDmdzbxnG9RMyxTQC+4ieaFloLE2mqS4nX+QfrXL2bQje5kjT Z75A== X-Gm-Message-State: AOAM530JFWgm7ZbikFi5yGHZPqKqlIBDz6bouAcNXrv+GwOD42DHbO0Q ZhNloSGf47NS1bAS5aJOjp4JBQ== X-Received: by 2002:a05:6000:114e:: with SMTP id d14mr899685wrx.281.1619135388149; Thu, 22 Apr 2021 16:49:48 -0700 (PDT) Received: from localhost.localdomain (2.0.5.1.1.6.3.8.5.c.c.3.f.b.d.3.0.0.0.0.6.1.f.d.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:df16:0:3dbf:3cc5:8361:1502]) by smtp.gmail.com with ESMTPSA id l13sm6156326wrt.14.2021.04.22.16.49.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:49:47 -0700 (PDT) From: Phillip Potter To: davem@davemloft.net Cc: kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sd@queasysnail.net, edumazet@google.com, fw@strlen.de Subject: [PATCH v2] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb Date: Fri, 23 Apr 2021 00:49:45 +0100 Message-Id: <20210422234945.1190-1-phil@philpotter.co.uk> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- V2: * Incorporated feedback from Sabrina Dubroca regarding pskb_inet_may_pull * Added Fixes: tag as requested by Eric Dumazet --- 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 42f31c681846..61cd3dd4deab 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