netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/2] ipv6: fix a refcnt leak with peer addr
@ 2014-09-03 21:59 Nicolas Dichtel
  2014-09-03 21:59 ` [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove " Nicolas Dichtel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nicolas Dichtel @ 2014-09-03 21:59 UTC (permalink / raw)
  To: yoshfuji, davem; +Cc: netdev, Nicolas Dichtel

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>
---
 net/ipv6/addrconf.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0b239fc1816e..e75ecb1e848b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4777,11 +4777,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);
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove peer addr
  2014-09-03 21:59 [PATCH net 1/2] ipv6: fix a refcnt leak with peer addr Nicolas Dichtel
@ 2014-09-03 21:59 ` Nicolas Dichtel
  2014-09-03 23:51   ` Hannes Frederic Sowa
  2014-09-06  0:13   ` David Miller
  2014-09-03 23:43 ` [PATCH net 1/2] ipv6: fix a refcnt leak with " Hannes Frederic Sowa
  2014-09-06  0:13 ` David Miller
  2 siblings, 2 replies; 6+ messages in thread
From: Nicolas Dichtel @ 2014-09-03 21:59 UTC (permalink / raw)
  To: yoshfuji, davem; +Cc: netdev, Nicolas Dichtel

addrconf_get_prefix_route() ensures to get the right route in the right table.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv6/addrconf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e75ecb1e848b..bb9ca1655cc5 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4773,10 +4773,9 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
 		addrconf_leave_solict(ifp->idev, &ifp->addr);
 		if (!ipv6_addr_any(&ifp->peer_addr)) {
 			struct rt6_info *rt;
-			struct net_device *dev = ifp->idev->dev;
 
-			rt = rt6_lookup(dev_net(dev), &ifp->peer_addr, NULL,
-					dev->ifindex, 1);
+			rt = addrconf_get_prefix_route(&ifp->peer_addr, 128,
+						       ifp->idev->dev, 0, 0);
 			if (rt && ip6_del_rt(rt))
 				dst_free(&rt->dst);
 		}
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net 1/2] ipv6: fix a refcnt leak with peer addr
  2014-09-03 21:59 [PATCH net 1/2] ipv6: fix a refcnt leak with peer addr Nicolas Dichtel
  2014-09-03 21:59 ` [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove " Nicolas Dichtel
@ 2014-09-03 23:43 ` Hannes Frederic Sowa
  2014-09-06  0:13 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Hannes Frederic Sowa @ 2014-09-03 23:43 UTC (permalink / raw)
  To: Nicolas Dichtel, yoshfuji, davem; +Cc: netdev



On Wed, Sep 3, 2014, at 23:59, Nicolas Dichtel wrote:
> 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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove peer addr
  2014-09-03 21:59 ` [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove " Nicolas Dichtel
@ 2014-09-03 23:51   ` Hannes Frederic Sowa
  2014-09-06  0:13   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Hannes Frederic Sowa @ 2014-09-03 23:51 UTC (permalink / raw)
  To: Nicolas Dichtel, yoshfuji, davem; +Cc: netdev

On Wed, Sep 3, 2014, at 23:59, Nicolas Dichtel wrote:
> addrconf_get_prefix_route() ensures to get the right route in the right
> table.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Also good!

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Thanks,
Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 1/2] ipv6: fix a refcnt leak with peer addr
  2014-09-03 21:59 [PATCH net 1/2] ipv6: fix a refcnt leak with peer addr Nicolas Dichtel
  2014-09-03 21:59 ` [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove " Nicolas Dichtel
  2014-09-03 23:43 ` [PATCH net 1/2] ipv6: fix a refcnt leak with " Hannes Frederic Sowa
@ 2014-09-06  0:13 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-09-06  0:13 UTC (permalink / raw)
  To: nicolas.dichtel; +Cc: yoshfuji, netdev

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Wed,  3 Sep 2014 23:59:21 +0200

> 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>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove peer addr
  2014-09-03 21:59 ` [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove " Nicolas Dichtel
  2014-09-03 23:51   ` Hannes Frederic Sowa
@ 2014-09-06  0:13   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2014-09-06  0:13 UTC (permalink / raw)
  To: nicolas.dichtel; +Cc: yoshfuji, netdev

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Wed,  3 Sep 2014 23:59:22 +0200

> addrconf_get_prefix_route() ensures to get the right route in the right table.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-06  0:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03 21:59 [PATCH net 1/2] ipv6: fix a refcnt leak with peer addr Nicolas Dichtel
2014-09-03 21:59 ` [PATCH net 2/2] ipv6: use addrconf_get_prefix_route() to remove " Nicolas Dichtel
2014-09-03 23:51   ` Hannes Frederic Sowa
2014-09-06  0:13   ` David Miller
2014-09-03 23:43 ` [PATCH net 1/2] ipv6: fix a refcnt leak with " Hannes Frederic Sowa
2014-09-06  0:13 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).