From: Miaoqian Lin <linmq006@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Joshua Hunt <johunt@akamai.com>,
Vishwanath Pai <vpai@akamai.com>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: linmq006@gmail.com
Subject: [PATCH] netfilter: xt_hashlimit: fix inconsistent return type in hashlimit_mt_*
Date: Fri, 29 Aug 2025 20:51:31 +0800 [thread overview]
Message-ID: <20250829125132.2026448-1-linmq006@gmail.com> (raw)
The hashlimit_mt_v1() and hashlimit_mt_v2() functions return the
cfg_copy() error code (-EINVAL) instead of false when configuration
copying fails. Since these functions are declared to return bool,
-EINVAL is interpreted as true, which is misleading.
Fixes: 11d5f15723c9 ("netfilter: xt_hashlimit: Create revision 2 to support higher pps rates")
Fixes: bea74641e378 ("netfilter: xt_hashlimit: add rate match mode")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
net/netfilter/xt_hashlimit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 3b507694e81e..de54d8f37852 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -806,7 +806,7 @@ hashlimit_mt_v1(const struct sk_buff *skb, struct xt_action_param *par)
ret = cfg_copy(&cfg, (void *)&info->cfg, 1);
if (ret)
- return ret;
+ return false;
return hashlimit_mt_common(skb, par, hinfo, &cfg, 1);
}
@@ -821,7 +821,7 @@ hashlimit_mt_v2(const struct sk_buff *skb, struct xt_action_param *par)
ret = cfg_copy(&cfg, (void *)&info->cfg, 2);
if (ret)
- return ret;
+ return false;
return hashlimit_mt_common(skb, par, hinfo, &cfg, 2);
}
--
2.35.1
next reply other threads:[~2025-08-29 12:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 12:51 Miaoqian Lin [this message]
2025-08-29 13:18 ` [PATCH] netfilter: xt_hashlimit: fix inconsistent return type in hashlimit_mt_* Phil Sutter
2025-08-29 14:16 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250829125132.2026448-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=johunt@akamai.com \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=vpai@akamai.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).