Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2876213rwb; Mon, 15 Aug 2022 13:07:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR4idtY/WQej7mFTJuSNAa8kV39qWQK3vjI9jStE0zOe72UcqZgQSnwWenXVjbKBbLMX9TbG X-Received: by 2002:a17:90b:1b4a:b0:1f5:5578:6398 with SMTP id nv10-20020a17090b1b4a00b001f555786398mr19957360pjb.122.1660594020613; Mon, 15 Aug 2022 13:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594020; cv=none; d=google.com; s=arc-20160816; b=XZjUoGDataHcRRyALo8YxYjb6emXywuap8gYomM1PXFLWuc3NEuNKJ2JvZmk1Ab+VV itQv9SzaiZqn1O1MYL7H+ZANY9lY4hU+xaQgHmK8rTorZqpSUJksCbavWjg8umnXWJMn ROigPbuTRBUvFw/e0zDPqsvQbNEKPLpU3ZH+eG7NuyQO/3XXQQ3c2bUIKoAebM5t61xJ tptMoUQWfp2BTaVuUAUeEPwR8V+Ptv56CqjI0rqlDdkdAPFoW4tHV7EgGIVzn1RIQsw7 38Wi6aLF6WhnclsrdbR9LeGkxpKhq+tblcdtVeuDJgpZyCSGO93WDDqfRS63rC5FR3U2 dBzA== 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=051ePPhfQkK3D+g7EFsvKV1B1B6XrATuoJEJPWxFugs=; b=IIiUHmM2MoHJC8oLj/SPSQ5WwQa4uy3tnu5fA0OTvWOMe4IKxtSLWWPFg9pADzulaw WH1up5GSwMzaxy/ZHUfRsKKQ8O5Ui4kecnfjaChwWPOOX8/rKxeO4JzGGEavaZ+Yq1z3 yMR/DxKaLEO15/MRJ5HgMEzPUQ2qm3H/8KcWDH5LkcXbj1HPk4aNqYgr6JHhHuof5xpi 0m1I7FjqHug4fXuMHuRrC5r2/CJMxs1pHNzUba6MgKQWrpjS3fR0nyMjzB93olZNXhfl 7bM4EZFt5q9d/0STRUK2IdgRPKkwm3JoZX1KPkNnn1nJVzUkoOSmRmaDfZHZmxOfaoSl FaXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LrR4XVEA; 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 t69-20020a638148000000b0041d66281046si10572700pgd.232.2022.08.15.13.06.48; Mon, 15 Aug 2022 13:07:00 -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=LrR4XVEA; 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 S243467AbiHOSce (ORCPT + 99 others); Mon, 15 Aug 2022 14:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242033AbiHOSbg (ORCPT ); Mon, 15 Aug 2022 14:31:36 -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 E01FF33404; Mon, 15 Aug 2022 11:21:24 -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 36273B8107B; Mon, 15 Aug 2022 18:21:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71CE7C433D6; Mon, 15 Aug 2022 18:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587681; bh=2ovyApPiME4/c5U9s2pafwbgUslndUbYq4uX2bqjewE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrR4XVEA9skn3QTNc5IdLITZA0lcfASO4RknZnveyimGUyFpCZfQGaMjHV+fLQIen FnEDLPLEF/ilR89zPlJi530fnSzasGT1gSeVjInmrEf6PdT2VgYiYr5GHX+8V6/Vak GY9Bb2b+QedSoS0rClkk7DLN08iVO+zuJ5o92THU= 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.15 154/779] netfilter: nf_tables: add rescheduling points during loop detection walks Date: Mon, 15 Aug 2022 19:56:38 +0200 Message-Id: <20220815180343.899696572@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 13d14fcc2371..3d52a08bd560 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3248,6 +3248,8 @@ int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain) if (err < 0) return err; } + + cond_resched(); } return 0; @@ -9225,9 +9227,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