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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y43/iCzGY7qJckCe@salvia>
Date:   Mon, 5 Dec 2022 15:26:16 +0100
From:   Pablo Neira Ayuso <pablo@...filter.org>
To:     Li Qiong <liqiong@...china.com>
Cc:     Jozsef Kadlecsik <kadlec@...filter.org>,
        Florian Westphal <fw@...len.de>,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, netfilter-devel@...r.kernel.org,
        kernel-janitors@...r.kernel.org, coreteam@...filter.org,
        Yu Zhe <yuzhe@...china.com>
Subject: Re: [PATCH] netfilter: initialize 'ret' variable

On Fri, Dec 02, 2022 at 03:03:31PM +0800, Li Qiong wrote:
> The 'ret' should need to be initialized to 0, in case
> return a uninitialized value.
> 
> Signed-off-by: Li Qiong <liqiong@...china.com>
> ---
>  net/netfilter/nf_flow_table_ip.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
> index b350fe9d00b0..225ff865d609 100644
> --- a/net/netfilter/nf_flow_table_ip.c
> +++ b/net/netfilter/nf_flow_table_ip.c
> @@ -351,7 +351,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
>  	struct rtable *rt;
>  	struct iphdr *iph;
>  	__be32 nexthop;
> -	int ret;
> +	int ret = 0;
>  
>  	if (skb->protocol != htons(ETH_P_IP) &&
>  	    !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IP), &offset))
> @@ -613,7 +613,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
>  	u32 hdrsize, offset = 0;
>  	struct ipv6hdr *ip6h;
>  	struct rt6_info *rt;
> -	int ret;
> +	int ret = 0;
>  
>  	if (skb->protocol != htons(ETH_P_IPV6) &&
>  	    !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IPV6), &offset))

This can only happen with tuplehash->tuple.xmit_type:

- FLOW_OFFLOAD_XMIT_UNSPEC
- FLOW_OFFLOAD_XMIT_TC

but this should not ever happen in that path.

Instead, I'd suggest to add a 'default' case to the switch, set ret to
NF_DROP and WARN_ON_ONCE(1).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ