]> err.no Git - linux-2.6/commitdiff
[IPV6]: Make sure error handling is done when calling ip6_route_output().
authorVille Nuorvala <vnuorval@tcs.hut.fi>
Tue, 17 Oct 2006 05:10:05 +0000 (22:10 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 19 Oct 2006 02:55:27 +0000 (19:55 -0700)
As ip6_route_output() never returns NULL, error checking must be done by
looking at dst->error in stead of comparing dst against NULL.

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

index 73cee2ec07e8ed22fcba162427ce91622e5d7f59..d400f8fae1291ed265a9bdfe1133a9e6b6306359 100644 (file)
 static struct dst_ops xfrm6_dst_ops;
 static struct xfrm_policy_afinfo xfrm6_policy_afinfo;
 
-static int xfrm6_dst_lookup(struct xfrm_dst **dst, struct flowi *fl)
+static int xfrm6_dst_lookup(struct xfrm_dst **xdst, struct flowi *fl)
 {
-       int err = 0;
-       *dst = (struct xfrm_dst*)ip6_route_output(NULL, fl);
-       if (!*dst)
-               err = -ENETUNREACH;
+       struct dst_entry *dst = ip6_route_output(NULL, fl);
+       int err = dst->error;
+       if (!err)
+               *xdst = (struct xfrm_dst *) dst;
+       else
+               dst_release(dst);
        return err;
 }
 
index 249e5033c1a86d7d3d4ec66b20549705a51cf0a2..78071c6e6cf10522a3e35162c12ec06cba383a1b 100644 (file)
@@ -215,17 +215,17 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
        }
 
        dst = ip6_route_output(NULL, &fl);
-       if (dst) {
+       if (!dst->error) {
                struct rt6_info *rt;
                rt = (struct rt6_info *)dst;
                SCTP_DEBUG_PRINTK(
                        "rt6_dst:" NIP6_FMT " rt6_src:" NIP6_FMT "\n",
                        NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr));
-       } else {
-               SCTP_DEBUG_PRINTK("NO ROUTE\n");
+               return dst;
        }
-
-       return dst;
+       SCTP_DEBUG_PRINTK("NO ROUTE\n");
+       dst_release(dst);
+       return NULL;
 }
 
 /* Returns the number of consecutive initial bits that match in the 2 ipv6