Message ID | 1412640315-22472-2-git-send-email-kafai@fb.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
From: Martin KaFai Lau <kafai@fb.com> Date: Mon, 6 Oct 2014 17:05:14 -0700 > The above BACKTRACK have already caught the rt == net->ipv6.ip6_null_entry case > > Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> > Signed-off-by: Martin KaFai Lau <kafai@fb.com> ... > @@ -936,8 +936,7 @@ restart: > if (rt->rt6i_nsiblings) > rt = rt6_multipath_select(rt, fl6, oif, strict | reachable); > BACKTRACK(net, &fl6->saddr); > - if (rt == net->ipv6.ip6_null_entry || > - rt->rt6i_flags & RTF_CACHE) > + if (rt->rt6i_flags & RTF_CACHE) > goto out; > > dst_hold(&rt->dst); I think this is sort of going in the wrong direction. The BACKTRACK() macro hides a lot of side effects inside of it's implementation, and worst of all it hides a change of control flow with it's "goto out;" and "goto restart;" I'd rather see us clean this up in some way that someone auditing this code won't be tricked into missing the control flow side effects, than adding more dependencies upon BACKTRACK()'s implementation. Thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index bafde82..d53dc4f 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -936,8 +936,7 @@ restart: if (rt->rt6i_nsiblings) rt = rt6_multipath_select(rt, fl6, oif, strict | reachable); BACKTRACK(net, &fl6->saddr); - if (rt == net->ipv6.ip6_null_entry || - rt->rt6i_flags & RTF_CACHE) + if (rt->rt6i_flags & RTF_CACHE) goto out; dst_hold(&rt->dst);
The above BACKTRACK have already caught the rt == net->ipv6.ip6_null_entry case Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: Martin KaFai Lau <kafai@fb.com> --- net/ipv6/route.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)