From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A97AC35249 for ; Sun, 2 Feb 2020 22:37:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 371672067C for ; Sun, 2 Feb 2020 22:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbgBBWhb (ORCPT ); Sun, 2 Feb 2020 17:37:31 -0500 Received: from Chamillionaire.breakpoint.cc ([193.142.43.52]:56252 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726971AbgBBWhb (ORCPT ); Sun, 2 Feb 2020 17:37:31 -0500 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1iyNrs-0007uX-NL; Sun, 02 Feb 2020 23:37:28 +0100 Date: Sun, 2 Feb 2020 23:37:28 +0100 From: Florian Westphal To: Cong Wang Cc: Florian Westphal , Linux Kernel Network Developers , NetFilter , syzbot , Pablo Neira Ayuso , Jozsef Kadlecsik Subject: Re: [Patch nf 3/3] xt_hashlimit: limit the max size of hashtable Message-ID: <20200202223728.GO795@breakpoint.cc> References: <20200131205216.22213-1-xiyou.wangcong@gmail.com> <20200131205216.22213-4-xiyou.wangcong@gmail.com> <20200131220807.GJ795@breakpoint.cc> <20200131233659.GM795@breakpoint.cc> <20200202061611.GN795@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Cong Wang wrote: > Ok, so here is what I have now: > > > +#define HASHLIMIT_MAX_SIZE 1048576 > + > static int hashlimit_mt_check_common(const struct xt_mtchk_param *par, > struct xt_hashlimit_htable **hinfo, > struct hashlimit_cfg3 *cfg, > @@ -847,6 +849,14 @@ static int hashlimit_mt_check_common(const struct > xt_mtchk_param *par, > > if (cfg->gc_interval == 0 || cfg->expire == 0) > return -EINVAL; > + if (cfg->size > HASHLIMIT_MAX_SIZE) { > + cfg->size = HASHLIMIT_MAX_SIZE; > + pr_info_ratelimited("size too large, truncated to > %u\n", cfg->size); > + } > + if (cfg->max > HASHLIMIT_MAX_SIZE) { > + cfg->max = HASHLIMIT_MAX_SIZE; > + pr_info_ratelimited("max too large, truncated to > %u\n", cfg->max); > + } > > Please let me know if it is still different with your suggestion. I am fine with this.