From nobody Fri Oct 24 20:51:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0BB8C32762 for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348093AbiHOUcE (ORCPT ); Mon, 15 Aug 2022 16:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347612AbiHOU0O (ORCPT ); Mon, 15 Aug 2022 16:26:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E059C4D4D1; Mon, 15 Aug 2022 12:03:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8683EB81062; Mon, 15 Aug 2022 19:03:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0E32C433C1; Mon, 15 Aug 2022 19:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590204; bh=KKtD5woFp4mx26d04LR6BTuiJ3NABKRQBnDLRu+qUrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4aa3w5HdUCxnUsekevECizDERInYmaA4V83RnWlMnUgd35dIvp4U/O8KIFnYS22o uWnkCUDOM2tDFruNek8CCMlmWz+QHBiqrmJkml4yg4uTi0QxpANCP3BqLTLImVyioT Lm1avYeimIXCpps5a0YfcPl+BFjI0VpgDKHBSl1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 0185/1095] netfilter: nf_tables: add rescheduling points during loop detection walks Date: Mon, 15 Aug 2022 19:53:04 +0200 Message-Id: <20220815180437.286523400@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 81ea010667417ef3f218dfd99b69769fe66c2b67 ] Add explicit rescheduling points during ruleset walk. Switching to a faster algorithm is possible but this is a much smaller change, suitable for nf tree. Link: https://bugzilla.netfilter.org/show_bug.cgi?id=3D1460 Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_tables_api.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 2b60923cf87b..7eac496961a7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3343,6 +3343,8 @@ int nft_chain_validate(const struct nft_ctx *ctx, con= st struct nft_chain *chain) if (err < 0) return err; } + + cond_resched(); } =20 return 0; @@ -9371,9 +9373,13 @@ static int nf_tables_check_loops(const struct nft_ct= x *ctx, break; } } + + cond_resched(); } =20 list_for_each_entry(set, &ctx->table->sets, list) { + cond_resched(); + if (!nft_is_active_next(ctx->net, set)) continue; if (!(set->flags & NFT_SET_MAP) || --=20 2.35.1