Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2928146rwb; Mon, 15 Aug 2022 14:13:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR41ql+ZGIeR2oSbm5rROb6FTwW3Bn6qcWVXVFQ1WcuFkBwkExN2swbLgisL06sHL5lR1KZH X-Received: by 2002:a05:6402:26c1:b0:43d:afb9:220c with SMTP id x1-20020a05640226c100b0043dafb9220cmr16288172edd.26.1660598021406; Mon, 15 Aug 2022 14:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598021; cv=none; d=google.com; s=arc-20160816; b=SuPOGrRQDYj2I3cahh1So5ys4KMbeNl3DFtv5FPlIfKNwyz35h/hOfIyzpI2BR5BaV mudIK7FttFxSU1/GUMeBRR5O9iKHWUXoSs1tSNlQ0UI7cd6MjdyhSnuVBKqJXpfBjyvR glgANpKB1KkAQYFAASjw0ALlFNVoqINuCw/zf8x6j06+Li+6LzPjpjUThn5NWrpBHLp8 wdxyxKwImGMInIoi+Zr1o+2ZmYdwIvZe52lv6xCg2G8KgKnBjzuHc54OUdgql0LCOvnl n9Y1ZkN/ZQWai+Zgqojenv572A4CkoTLKKVXrBiqX2m+qEAdDqV8h/HTT+5dGuK2pGAz 2QKA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5vN6P12ja/YMQvgQbcxEhkSYakO2jJEZ6epqR7x3AR0=; b=j2jJ/DD88dIipcs9/n7RTww3Ye1jbZtZwr3a1RLnoMakQUlrumzIeBfP8sPgQB8DQM w4AA0YuRDPQhz8iXNxhiGEhSWogOykC+ZaiMdwDb22PWmVxt9ufTobVfcQhKd472qpBl eY1b4vh0IBFBCZOP2tJeGGj3u2z5tbmwWONZCl++SAWFxuyPeopvwLb8GVEzqqt8KGqc HCTJHzzLB5HpcEUgpQ5jMCd10r3VeRu0WLMgWEOoLjlPP6WFJQ9byqRN7yLAP2SdOZiE ueAjfuouEOf2/P9af+USYdaxzEL51k/K4tMLAldIbCXwRFPNDPFPwG12x4RgDtXAHq5U nr0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z4aa3w5H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gv3-20020a1709072bc300b007317733951dsi7071807ejc.56.2022.08.15.14.13.15; Mon, 15 Aug 2022 14:13:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z4aa3w5H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348088AbiHOUcE (ORCPT + 99 others); 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=1460 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, const struct nft_chain *chain) if (err < 0) return err; } + + cond_resched(); } return 0; @@ -9371,9 +9373,13 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx, break; } } + + cond_resched(); } 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) || -- 2.35.1