lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aLG2TumWk_kgK6zN@strlen.de>
Date: Fri, 29 Aug 2025 16:16:46 +0200
From: Florian Westphal <fw@...len.de>
To: Miaoqian Lin <linmq006@...il.com>
Cc: 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
Subject: Re: [PATCH] netfilter: xt_hashlimit: fix inconsistent return type in
 hashlimit_mt_*

Miaoqian Lin <linmq006@...il.com> wrote:
> 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.

Could you please check if its possible to rework cfg_copy() to not
return anything?

> --- 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;

AFAICS cfg_copy cannot return an error.

You could try adding an enum for the version field to xt_hashlimit.c,
then use switch/case to let compiler complain for other values.

Or try to replace the else branch error return with BUILD_BUG(),
compiler should be able to figure this out.

You might have to add __always_inline hint.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ