ipv6: Check rt->dst.from for the DST_NOCACHE route
[firefly-linux-kernel-4.4.55.git] / net / ipv6 / route.c
index 3754cf9287a05a9a66497459a899f76185d4283b..6f01fe122abd7c0348bfcd67d1a55ecb40f1c0b0 100644 (file)
@@ -1281,7 +1281,8 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)
 
        rt6_dst_from_metrics_check(rt);
 
-       if ((rt->rt6i_flags & RTF_PCPU) || unlikely(dst->flags & DST_NOCACHE))
+       if (rt->rt6i_flags & RTF_PCPU ||
+           (unlikely(dst->flags & DST_NOCACHE) && rt->dst.from))
                return rt6_dst_from_check(rt, cookie);
        else
                return rt6_check(rt, cookie);