• Martin KaFai Lau's avatar
    ipv6: Avoid double dst_free · 8e3d5be7
    Martin KaFai Lau authored
    It is a prep work to get dst freeing from fib tree undergo
    a rcu grace period.
    
    The following is a common paradigm:
    if (ip6_del_rt(rt))
    	dst_free(rt)
    
    which means, if rt cannot be deleted from the fib tree, dst_free(rt) now.
    1. We don't know the ip6_del_rt(rt) failure is because it
       was not managed by fib tree (e.g. DST_NOCACHE) or it had already been
       removed from the fib tree.
    2. If rt had been managed by the fib tree, ip6_del_rt(rt) failure means
       dst_free(rt) has been called already.  A second
       dst_free(rt) is not always obviously safe.  The rt may have
       been destroyed already.
    3. If rt is a DST_NOCACHE, dst_free(rt) should not be called.
    4. It is a stopper to make dst freeing from fib tree undergo a
       rcu grace period.
    
    This patch is to use a DST_NOCACHE flag to indicate a rt is
    not managed by the fib tree.
    Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8e3d5be7
addrconf.c 144 KB