netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] xfrm: release neighbor upon dst destruction
@ 2013-02-18 12:36 Romain KUNTZ
  2013-02-18 19:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Romain KUNTZ @ 2013-02-18 12:36 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: Steffen Klassert, davem@davemloft.net Miller,
	yoshfuji@linux-ipv6.org Hideaki

Neighbor is cloned in xfrm6_fill_dst but seems to never be released.
Neighbor entry should be released when XFRM6 dst entry is destroyed
in xfrm6_dst_destroy, otherwise references may be kept forever on 
the device pointed by the neighbor entry.

I may not have understood all the subtleties of XFRM & dst so I would
be happy to receive comments on this patch. 

Signed-off-by: Romain Kuntz <r.kuntz@ipflavors.com>
---
 net/ipv6/xfrm6_policy.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index c984413..8f32718 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -236,6 +236,8 @@ static void xfrm6_dst_destroy(struct dst_entry *dst)
 {
 	struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
 
+	if (likely(xdst->u.rt6.n))
+		neigh_release(xdst->u.rt6.n);
 	if (likely(xdst->u.rt6.rt6i_idev))
 		in6_dev_put(xdst->u.rt6.rt6i_idev);
 	dst_destroy_metrics_generic(dst);
-- 
1.7.2.5

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

* Re: [RFC PATCH] xfrm: release neighbor upon dst destruction
  2013-02-18 12:36 [RFC PATCH] xfrm: release neighbor upon dst destruction Romain KUNTZ
@ 2013-02-18 19:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-02-18 19:58 UTC (permalink / raw)
  To: r.kuntz; +Cc: netdev, steffen.klassert, yoshfuji

From: Romain KUNTZ <r.kuntz@ipflavors.com>
Date: Mon, 18 Feb 2013 13:36:24 +0100

> Neighbor is cloned in xfrm6_fill_dst but seems to never be released.
> Neighbor entry should be released when XFRM6 dst entry is destroyed
> in xfrm6_dst_destroy, otherwise references may be kept forever on 
> the device pointed by the neighbor entry.
> 
> I may not have understood all the subtleties of XFRM & dst so I would
> be happy to receive comments on this patch. 
> 
> Signed-off-by: Romain Kuntz <r.kuntz@ipflavors.com>

This patch is definitely correct.

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2013-02-18 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-18 12:36 [RFC PATCH] xfrm: release neighbor upon dst destruction Romain KUNTZ
2013-02-18 19:58 ` 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).