From patchwork Mon Jul 1 17:02:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1954857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WCXQy6pN0z1xpl for ; Tue, 2 Jul 2024 03:02:34 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sOKQ5-0002Jn-R3; Mon, 01 Jul 2024 17:02:25 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sOKQ2-0002Is-Fv for kernel-team@lists.ubuntu.com; Mon, 01 Jul 2024 17:02:22 +0000 Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id F04943F4BE for ; Mon, 1 Jul 2024 17:02:21 +0000 (UTC) Received: by mail-il1-f198.google.com with SMTP id e9e14a558f8ab-3737b3ee909so38786965ab.2 for ; Mon, 01 Jul 2024 10:02:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719853340; x=1720458140; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2kRyLxDsxt878lrjAssZvjQV3valx35wwOmb6pOWqiI=; b=C4EU/5owF4sx93z0qXkDnVFDm3L3FhF7NOYY1rPqmRUX8aDuMT57grLpWxYom19Jtm zaD5jJ8NF77NRXyaUX4JdXj2IJQGXL8BSgCTOsX6xl99BQkziHTuPt82kM6YFqVehtkP Qf8eBDpdlYUCwV9qeSfkuI4KhlPycXL4xqihtWcxyoS1t76eLflQbu1Ln/Vkg+U3Q8TF 0QgbYXLMhBEXaUoIfpvkVexxQncuAE+uSFLVrZU5dKwM3KGbclqbakybvNbcWAlVVn5W aL9bXhcDviXHqny6B3iD018ennh92/kasY23TrN1DiUa3UkQYlYDgBpaYoYh9SddKTM4 nuCg== X-Gm-Message-State: AOJu0Yz5SOomOKV+xzqDEmjhvYfkU7pqh6YVbxCZoCQonYRvKRH+M0Gp jTPefEe7Xkvg6E1XHviMaL/yI8Z8BRvMSzHutS2Zqz7W4giwKgt2OvXOuXzkbmOTvC7D8w8Efl+ l1TL2+Mwmqr1eviex/Fi2i8UDYuCH6hxC4dB3582ghYsXhwX1CAo/37xtyZ3yGl8q0y8kSA0nqN bUT39ukau8gw== X-Received: by 2002:a05:6e02:158c:b0:375:9e20:beef with SMTP id e9e14a558f8ab-37cce25dbaemr78663825ab.0.1719853340066; Mon, 01 Jul 2024 10:02:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjbwpP3b9OM4YzUJe9xnSf/a49SHN722SklM7k0Li2BSMaNWSRR6PBatIEUyLekMx8hYJbYA== X-Received: by 2002:a05:6e02:158c:b0:375:9e20:beef with SMTP id e9e14a558f8ab-37cce25dbaemr78663425ab.0.1719853338937; Mon, 01 Jul 2024 10:02:18 -0700 (PDT) Received: from smtp.gmail.com (167-248-51-36.oa02.lnk04.ne.dynamic.allophone.net. [167.248.51.36]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-37ad29814d9sm19744055ab.21.2024.07.01.10.02.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 10:02:18 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][J][PATCH v2 3/3] netfilter: nf_tables: missing iterator type in lookup walk Date: Mon, 1 Jul 2024 12:02:15 -0500 Message-Id: <20240701170215.17623-4-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240701170215.17623-1-bethany.jamison@canonical.com> References: <20240701170215.17623-1-bethany.jamison@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: Pablo Neira Ayuso Add missing decorator type to lookup expression and tighten WARN_ON_ONCE check in pipapo to spot earlier that this is unset. Fixes: 29b359cf6d95 ("netfilter: nft_set_pipapo: walk over current view on netlink dump") Signed-off-by: Pablo Neira Ayuso (cherry picked from commit efefd4f00c967d00ad7abe092554ffbb70c1a793) CVE-2024-27017 Signed-off-by: Bethany Jamison --- net/netfilter/nft_lookup.c | 1 + net/netfilter/nft_set_pipapo.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/netfilter/nft_lookup.c b/net/netfilter/nft_lookup.c index 9d18c5428d53c..8c33159d11fe2 100644 --- a/net/netfilter/nft_lookup.c +++ b/net/netfilter/nft_lookup.c @@ -210,6 +210,7 @@ static int nft_lookup_validate(const struct nft_ctx *ctx, return 0; iter.genmask = nft_genmask_next(ctx->net); + iter.type = NFT_ITER_UPDATE; iter.skip = 0; iter.count = 0; iter.err = 0; diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c index 56250c12aefa7..f2f8d15c9edac 100644 --- a/net/netfilter/nft_set_pipapo.c +++ b/net/netfilter/nft_set_pipapo.c @@ -2042,7 +2042,8 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set, const struct nft_pipapo_field *f; int i, r; - WARN_ON_ONCE(iter->type == NFT_ITER_UNSPEC); + WARN_ON_ONCE(iter->type != NFT_ITER_READ && + iter->type != NFT_ITER_UPDATE); rcu_read_lock(); if (iter->type == NFT_ITER_READ)