Received: from mail.netfilter.org (mail.netfilter.org [217.70.188.207]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9EA2BA3D; Tue, 17 Sep 2024 20:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.188.207 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726604724; cv=none; b=SyuqgTXvAi/JLWA/S6aw47LkeAK8b8XxbmFMDfLd0KgrBebWao6DvZibPxdKR78S/HzMYPjHoigKcz/TbdSO8q5yIUwEQYHMtw096PWGTj83XWjWqfzb3CHPuLsvUEQePSG7SfMs0Fg/WGb2HVNHI7EfWzHnrQaGDPrIYMvEBRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726604724; c=relaxed/simple; bh=pMn9AbJTN+3QXhFbwFFNkSIr1lIuSoPqE84muno+CLc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kj9dPq/abPfkzFwtkXL6U+fxG/bMNBcfGGwfXAvxeVyJJDACv+/lQYnw1bZwlNpHXG8cQ7EmiMYklsAGih7wosG6ND2jpSnTmlY+stRNmiFid25UMi29VaVrCx4zuLW/BcDzOSEX0zh1Nli1aids6tXRVgA+vfGRbEu91DiUpJs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; arc=none smtp.client-ip=217.70.188.207 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: gregkh@linuxfoundation.org, sashal@kernel.org, stable@vger.kernel.org Subject: [PATCH -stable,5.15 2/2] netfilter: nf_tables: missing iterator type in lookup walk Date: Tue, 17 Sep 2024 22:25:15 +0200 Message-Id: <20240917202515.179699-3-pablo@netfilter.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240917202515.179699-1-pablo@netfilter.org> References: <20240917202515.179699-1-pablo@netfilter.org> Precedence: bulk X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit commit efefd4f00c967d00ad7abe092554ffbb70c1a793 upstream. 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 --- 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 b9df27c2718b..4db3d02e61d3 100644 --- a/net/netfilter/nft_lookup.c +++ b/net/netfilter/nft_lookup.c @@ -211,6 +211,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 8cce39411619..8336f2052f22 100644 --- a/net/netfilter/nft_set_pipapo.c +++ b/net/netfilter/nft_set_pipapo.c @@ -2046,7 +2046,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) -- 2.30.2