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: <8561e9bf2ba64c6e28c7b09f9f4b1719b2489bb0.camel@redhat.com>
Date:   Mon, 18 Mar 2019 13:21:15 +0100
From:   Paolo Abeni <pabeni@...hat.com>
To:     Xin Long <lucien.xin@...il.com>,
        network dev <netdev@...r.kernel.org>
Cc:     davem@...emloft.net, David Ahern <dsa@...ulusnetworks.com>,
        Wei Wang <weiwan@...gle.com>
Subject: Re: [PATCH net] ipv6: make ip6_create_rt_rcu return ip6_null_entry
 instead of NULL

On Mon, 2019-03-18 at 19:36 +0800, Xin Long wrote:
> Jianlin reported a crash:
> 
>   [  381.484332] BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
>   [  381.619802] RIP: 0010:fib6_rule_lookup+0xa3/0x160
>   [  382.009615] Call Trace:
>   [  382.020762]  <IRQ>
>   [  382.030174]  ip6_route_redirect.isra.52+0xc9/0xf0
>   [  382.050984]  ip6_redirect+0xb6/0xf0
>   [  382.066731]  icmpv6_notify+0xca/0x190
>   [  382.083185]  ndisc_redirect_rcv+0x10f/0x160
>   [  382.102569]  ndisc_rcv+0xfb/0x100
>   [  382.117725]  icmpv6_rcv+0x3f2/0x520
>   [  382.133637]  ip6_input_finish+0xbf/0x460
>   [  382.151634]  ip6_input+0x3b/0xb0
>   [  382.166097]  ipv6_rcv+0x378/0x4e0
> 
> It was caused by the lookup function __ip6_route_redirect() returns NULL in
> fib6_rule_lookup() when ip6_create_rt_rcu() returns NULL.
> 
> So we fix it by simply making ip6_create_rt_rcu() return ip6_null_entry
> instead of NULL.
> 
> Fixes: e873e4b9cc7e ("ipv6: use fib6_info_hold_safe() when necessary")
> Reported-by: Jianlin Shi <jishi@...hat.com>
> Suggested-by: Paolo Abeni <pabeni@...hat.com>
> Signed-off-by: Xin Long <lucien.xin@...il.com>
> ---
>  net/ipv6/route.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 4ef4bbd..754777d 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1040,13 +1040,17 @@ static struct rt6_info *ip6_create_rt_rcu(struct fib6_info *rt)
>  	struct rt6_info *nrt;
>  
>  	if (!fib6_info_hold_safe(rt))
> -		return NULL;
> +		goto fallback;
>  
>  	nrt = ip6_dst_alloc(dev_net(dev), dev, flags);
> -	if (nrt)
> +	if (nrt) {
>  		ip6_rt_copy_init(nrt, rt);
> -	else
> +	} else {
>  		fib6_info_release(rt);
> +fallback:
> +		nrt = dev_net(dev)->ipv6.ip6_null_entry;
> +		dst_hold(&nrt->dst);
> +	}
>  
>  	return nrt;
>  }
> @@ -1096,10 +1100,6 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
>  		dst_hold(&rt->dst);
>  	} else {
>  		rt = ip6_create_rt_rcu(f6i);
> -		if (!rt) {
> -			rt = net->ipv6.ip6_null_entry;
> -			dst_hold(&rt->dst);
> -		}
>  	}
>  
>  	rcu_read_unlock();

Acked-by: Paolo Abeni <pabeni@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ