Skip to content

Commit

Permalink
ipv6: fix a refcnt leak with peer addr
Browse files Browse the repository at this point in the history
There is no reason to take a refcnt before deleting the peer address route.
It's done some lines below for the local prefix route because
inet6_ifa_finish_destroy() will release it at the end.
For the peer address route, we want to free it right now.

This bug has been introduced by commit
caeaba7 ("ipv6: add support of peer address").

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nicolas Dichtel authored and David S. Miller committed Sep 6, 2014
1 parent c199105 commit f24062b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4772,11 +4772,8 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)

rt = rt6_lookup(dev_net(dev), &ifp->peer_addr, NULL,
dev->ifindex, 1);
if (rt) {
dst_hold(&rt->dst);
if (ip6_del_rt(rt))
dst_free(&rt->dst);
}
if (rt && ip6_del_rt(rt))
dst_free(&rt->dst);
}
dst_hold(&ifp->rt->dst);

Expand Down

0 comments on commit f24062b

Please sign in to comment.