Re: [PATCH v2 net-next 3/5] ipv6: honor RT6_LOOKUP_F_DST_NOREF in rule lookup logic

From
Wei Wang <hidden>
Date
2019-06-19 23:25:49
Reply to
David Ahern, 2019-06-19
On Wed, Jun 19, 2019 at 4:12 PM David Ahern [off-list ref] wrote:
On 6/19/19 4:31 PM, Wei Wang wrote:
quoted
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index bcfae13409b5..d22b6c140f23 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -113,14 +113,15 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
              rt = lookup(net, net->ipv6.fib6_local_tbl, fl6, skb, flags);
              if (rt != net->ipv6.ip6_null_entry && rt->dst.error != -EAGAIN)
                      return &rt->dst;
-             ip6_rt_put(rt);
+             ip6_rt_put_flags(rt, flags);
              rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, skb, flags);
              if (rt->dst.error != -EAGAIN)
                      return &rt->dst;
-             ip6_rt_put(rt);
+             ip6_rt_put_flags(rt, flags);
      }

-     dst_hold(&net->ipv6.ip6_null_entry->dst);
+     if (!(flags & RT6_LOOKUP_F_DST_NOREF))
+             dst_hold(&net->ipv6.ip6_null_entry->dst);
      return &net->ipv6.ip6_null_entry->dst;
 }
What about the fib6_rule_lookup when CONFIG_IPV6_MULTIPLE_TABLES is
configured off? If caller passes in RT6_LOOKUP_F_DST_NOREF that version
is still taking a reference in the error path and does a put after the
lookup.
True. I missed that part. Thanks for catching it. Will update.
Thread (12 messages) 12 messages, 4 authors, last reply 2019-06-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help