]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ipv6: fix a refcnt leak with peer addr
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Wed, 3 Sep 2014 21:59:21 +0000 (23:59 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 6 Sep 2014 00:13:24 +0000 (17:13 -0700)
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
caeaba79009c ("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>
net/ipv6/addrconf.c

index aa0e135b808ccffd1387cf9e2a72c90a60da5755..ce761c7e6675521216732be46c3d86f028ed0dc3 100644 (file)
@@ -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);