提交 4251320f 编写于 作者: V Ville Nuorvala 提交者: David S. Miller

[IPV6]: Make sure error handling is done when calling ip6_route_output().

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: NVille Nuorvala <vnuorval@tcs.hut.fi>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 23c435f7
...@@ -25,12 +25,14 @@ ...@@ -25,12 +25,14 @@
static struct dst_ops xfrm6_dst_ops; static struct dst_ops xfrm6_dst_ops;
static struct xfrm_policy_afinfo xfrm6_policy_afinfo; 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; struct dst_entry *dst = ip6_route_output(NULL, fl);
*dst = (struct xfrm_dst*)ip6_route_output(NULL, fl); int err = dst->error;
if (!*dst) if (!err)
err = -ENETUNREACH; *xdst = (struct xfrm_dst *) dst;
else
dst_release(dst);
return err; return err;
} }
......
...@@ -215,17 +215,17 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc, ...@@ -215,17 +215,17 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
} }
dst = ip6_route_output(NULL, &fl); dst = ip6_route_output(NULL, &fl);
if (dst) { if (!dst->error) {
struct rt6_info *rt; struct rt6_info *rt;
rt = (struct rt6_info *)dst; rt = (struct rt6_info *)dst;
SCTP_DEBUG_PRINTK( SCTP_DEBUG_PRINTK(
"rt6_dst:" NIP6_FMT " rt6_src:" NIP6_FMT "\n", "rt6_dst:" NIP6_FMT " rt6_src:" NIP6_FMT "\n",
NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr)); NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr));
} else { return dst;
SCTP_DEBUG_PRINTK("NO ROUTE\n");
} }
SCTP_DEBUG_PRINTK("NO ROUTE\n");
return dst; dst_release(dst);
return NULL;
} }
/* Returns the number of consecutive initial bits that match in the 2 ipv6 /* Returns the number of consecutive initial bits that match in the 2 ipv6
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册