From 6e4153afdfe36d5cb1469a73ba022b088fe5409d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 10 Jul 2003 07:22:52 -0700 Subject: [IPV6]: Fix dst reference counting in ndisc_send_redirect(). --- net/ipv6/ndisc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 6c573e39e2829d..d75fa9ce723d5a 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1321,7 +1321,6 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, if (rt == NULL) return; dst = &rt->u.dst; - dst_clone(dst); err = xfrm_lookup(&dst, &fl, NULL, 0); if (err) { @@ -1329,16 +1328,17 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, return; } + rt = (struct rt6_info *) dst; + if (rt->rt6i_flags & RTF_GATEWAY) { ND_PRINTK1("ndisc_send_redirect: not a neighbour\n"); - dst_release(&rt->u.dst); + dst_release(dst); return; } - if (!xrlim_allow(&rt->u.dst, 1*HZ)) { - dst_release(&rt->u.dst); + if (!xrlim_allow(dst, 1*HZ)) { + dst_release(dst); return; } - dst_release(&rt->u.dst); if (dev->addr_len) { if (neigh->nud_state&NUD_VALID) { @@ -1348,6 +1348,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, We will make it later, when will be sure, that it is alive. */ + dst_release(dst); return; } } -- cgit 1.2.3-korg