From patchwork Tue Jun 15 14:17:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kleber Sacilotto de Souza X-Patchwork-Id: 1492262 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G49Q55z8Xz9sSn; Wed, 16 Jun 2021 00:17:48 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lt9st-0005yA-4F; Tue, 15 Jun 2021 14:17:43 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lt9sp-0005xr-WD for kernel-team@lists.ubuntu.com; Tue, 15 Jun 2021 14:17:40 +0000 Received: from mail-ed1-f70.google.com ([209.85.208.70]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lt9sp-0003EX-OT for kernel-team@lists.ubuntu.com; Tue, 15 Jun 2021 14:17:39 +0000 Received: by mail-ed1-f70.google.com with SMTP id t11-20020a056402524bb029038ffacf1cafso12937540edd.5 for ; Tue, 15 Jun 2021 07:17:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y6j25RYxv88O3nu6/wNficFpUEzCAaQf80nJJTzCyjs=; b=nph9iK8+NCOIBoh5pIkXrjHg4zzG8vNIeKWTChboZ4HqpasUHCF1yuXrh3tyN+KVcl 6IpZOQLslGx7SUFMi5GL6Rxw5xPZp6fdFPyj4oT48MUAAHkHCcN+HgY0ZBliS54Oj5xZ RgBKlHNjMPtVXvGatEo5viS5p0cMkuMUHCDl+93QNpSpkcr1yz8FgF0SmsKanmzvthJ8 xN8uGRJcYum5buu6PLlrB5iYqEgup5MbvD35A7Eq8+7BMkhePahxj2hh4fGTKQ4o8ydg YGUK2eoP533EXITONkipZOp5aqoQ2jpCmz5uk5pVNQnff5/2P2vHrCH1kA4jB7IaHK3h eltg== X-Gm-Message-State: AOAM5327/cs3WqSBDSBESZQfiUsVos4SWL/BugSguKGBl8in/0r5NcWI B9j8sUd3QSiy8OixtiMNM2Hu3K3I3PMa/E3JGzGJy+hcPot4WZwu3HTTGjCzUjlxKgvz7vVbD8K UIQEMswkXQM8zChCDgf2c0yTFgwkpEuRzUJH7ERUsVA== X-Received: by 2002:a05:6402:34c6:: with SMTP id w6mr23768413edc.174.1623766659487; Tue, 15 Jun 2021 07:17:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/ICFhifrcVdxSEXYQxkvQj3UGeEiaGrzpGZD95w2f35CBJqU6oNWywLKElfri2/B3yzyOTA== X-Received: by 2002:a05:6402:34c6:: with SMTP id w6mr23768384edc.174.1623766659249; Tue, 15 Jun 2021 07:17:39 -0700 (PDT) Received: from localhost.localdomain (ipbcc333e7.dynamic.kabel-deutschland.de. [188.195.51.231]) by smtp.gmail.com with ESMTPSA id c11sm11982535edr.80.2021.06.15.07.17.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 07:17:38 -0700 (PDT) From: Kleber Sacilotto de Souza To: kernel-team@lists.ubuntu.com Subject: [SRU][G][PATCH 1/1] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb Date: Tue, 15 Jun 2021 16:17:36 +0200 Message-Id: <20210615141736.509749-2-kleber.souza@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210615141736.509749-1-kleber.souza@canonical.com> References: <20210615141736.509749-1-kleber.souza@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Phillip Potter BugLink: https://bugs.launchpad.net/bugs/1931731 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 (cherry picked from commit d13f048dd40e8577260cd43faea8ec9b77520197) Signed-off-by: Kleber Sacilotto de Souza Acked-by: Thadeu Lima de Souza Cascardo Acked-by: Stefan Bader --- 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 c4beb7ce471a..40f30656a62a 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);