[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d8072bc4-75c1-0070-b599-ff49a7c161b6@cumulusnetworks.com>
Date: Mon, 18 Mar 2019 20:48:13 +0100
From: David Ahern <dsa@...ulusnetworks.com>
To: Xin Long <lucien.xin@...il.com>,
network dev <netdev@...r.kernel.org>
Cc: davem@...emloft.net, Wei Wang <weiwan@...gle.com>,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net] ipv6: make ip6_create_rt_rcu return ip6_null_entry
instead of NULL
On 3/18/19 12:36 PM, Xin Long wrote:
> 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;
> }
It seems appropriate for ip6_create_rt_rcu to always return an rt6_info
given its use and v6 design. Since ip6_dst_alloc can also fail (e.g.,
exceed gc_thresh) the fallback case should apply to both.
Powered by blists - more mailing lists