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]
Date:   Mon, 7 Nov 2022 10:58:13 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Jamie Gloudon <jamie.gloudon@....fr>
Cc:     netdev@...r.kernel.org, pabeni@...hat.com, davem@...emloft.net,
        edumazet@...gle.com, kuba@...nel.org, yoshfuji@...ux-ipv6.org,
        dsahern@...nel.org
Subject: Re: [PATCH net v3 1/1] ip6_tunnel: Correct mistake in if statement.

On Mon, Nov 07, 2022 at 04:31:22AM -0400, Jamie Gloudon wrote:
> Make sure t->dev->flags & IFF_UP is check first for logical reason.
> 
> Fixes: 6c1cb4393cc7 ("ip6_tunnel: fix ip6 tunnel lookup in collect_md
> mode")
> Signed-off-by: Jamie Gloudon <jamie.gloudon@....fr>
> ---
>  net/ipv6/ip6_tunnel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
> index 2fb4c6ad7243..22c71f991bb7 100644
> --- a/net/ipv6/ip6_tunnel.c
> +++ b/net/ipv6/ip6_tunnel.c
> @@ -162,7 +162,7 @@ ip6_tnl_lookup(struct net *net, int link,
>  		return cand;
>  
>  	t = rcu_dereference(ip6n->collect_md_tun);
> -	if (t && t->dev->flags & IFF_UP)
> +	if (t && (t->dev->flags & IFF_UP))

While this change makes is less ambiguous for reader, the C precedence
rules are clear and & evaluated before &&.
https://en.cppreference.com/w/c/language/operator_precedence

There is nothing to fix here.

Thanks

>  		return t;
>  
>  	t = rcu_dereference(ip6n->tnls_wc[0]);
> -- 
> 2.28.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ