Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18cf0d07 authored by Romain KUNTZ's avatar Romain KUNTZ Committed by David S. Miller
Browse files

xfrm: release neighbor upon dst destruction



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: default avatarRomain Kuntz <r.kuntz@ipflavors.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dca9ab92
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -236,6 +236,8 @@ static void xfrm6_dst_destroy(struct dst_entry *dst)
{
{
	struct xfrm_dst *xdst = (struct xfrm_dst *)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))
	if (likely(xdst->u.rt6.rt6i_idev))
		in6_dev_put(xdst->u.rt6.rt6i_idev);
		in6_dev_put(xdst->u.rt6.rt6i_idev);
	dst_destroy_metrics_generic(dst);
	dst_destroy_metrics_generic(dst);