diff options
author | Wei Wang <weiwan@google.com> | 2019-06-20 17:36:39 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-23 13:24:17 -0700 |
commit | d64a1f574a2957b4bcb06452d36cc1c6bf16e9fc (patch) | |
tree | b07474822bdef5a6e543daf192c8e23e3408e3fd /net/ipv6/ip6_fib.c | |
parent | 74109218b051c2431eec2569886627c7217e235a (diff) | |
download | linux-stable-d64a1f574a2957b4bcb06452d36cc1c6bf16e9fc.tar.gz linux-stable-d64a1f574a2957b4bcb06452d36cc1c6bf16e9fc.tar.bz2 linux-stable-d64a1f574a2957b4bcb06452d36cc1c6bf16e9fc.zip |
ipv6: honor RT6_LOOKUP_F_DST_NOREF in rule lookup logic
This patch specifically converts the rule lookup logic to honor this
flag and not release refcnt when traversing each rule and calling
lookup() on each routing table.
Similar to previous patch, we also need some special handling of dst
entries in uncached list because there is always 1 refcnt taken for them
even if RT6_LOOKUP_F_DST_NOREF flag is set.
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_fib.c')
-rw-r--r-- | net/ipv6/ip6_fib.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 1d16a01eccf5..5b1c9b5b9247 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -316,9 +316,10 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, skb, flags); if (rt->dst.error == -EAGAIN) { - ip6_rt_put(rt); + ip6_rt_put_flags(rt, flags); rt = net->ipv6.ip6_null_entry; - dst_hold(&rt->dst); + if (!(flags | RT6_LOOKUP_F_DST_NOREF)) + dst_hold(&rt->dst); } return &rt->dst; |