[IPV6]: Make sure fib6_rule_lookup doesn't return NULL
authorVille Nuorvala <vnuorval@tcs.hut.fi>
Tue, 8 Aug 2006 23:44:17 +0000 (16:44 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Sep 2006 21:54:12 +0000 (14:54 -0700)
The callers of fib6_rule_lookup don't expect it to return NULL,
therefore it must return ip6_null_entry whenever fib_rule_lookup fails.

Signed-off-by: Ville Nuorvala <vnuorval@tcs.hut.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/fib6_rules.c

index bf9bba8..22a2fdb 100644 (file)
@@ -63,7 +63,11 @@ struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
        if (arg.rule)
                fib_rule_put(arg.rule);
 
-       return (struct dst_entry *) arg.result;
+       if (arg.result)
+               return (struct dst_entry *) arg.result;
+
+       dst_hold(&ip6_null_entry.u.dst);
+       return &ip6_null_entry.u.dst;
 }
 
 static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,