[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250829125132.2026448-1-linmq006@gmail.com>
Date: Fri, 29 Aug 2025 20:51:31 +0800
From: Miaoqian Lin <linmq006@...il.com>
To: Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Joshua Hunt <johunt@...mai.com>,
Vishwanath Pai <vpai@...mai.com>,
netfilter-devel@...r.kernel.org,
coreteam@...filter.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: linmq006@...il.com
Subject: [PATCH] netfilter: xt_hashlimit: fix inconsistent return type in hashlimit_mt_*
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@...il.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
Powered by blists - more mailing lists