* [PATCH] net: vrf: Reset rt6i_idev in local dst after put
@ 2017-03-17 23:07 David Ahern
2017-03-22 0:51 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2017-03-17 23:07 UTC (permalink / raw)
To: netdev; +Cc: David Ahern
The VRF driver takes a reference to the inet6_dev on the VRF device for
its rt6_local dst when handling local traffic through the VRF device as
a loopback. When the device is deleted the driver does a put on the idev
but does not reset rt6i_idev in the rt6_info struct. When the dst is
destroyed, dst_destroy calls ip6_dst_destroy which does a second put for
what is essentially the same reference causing it to be prematurely freed.
Reset rt6i_idev after the put in the vrf driver.
Fixes: b4869aa2f881e ("net: vrf: ipv6 support for local traffic to
local addresses")
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
drivers/net/vrf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 7f28021d9d93..761ea041b018 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -462,8 +462,10 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf)
}
if (rt6_local) {
- if (rt6_local->rt6i_idev)
+ if (rt6_local->rt6i_idev) {
in6_dev_put(rt6_local->rt6i_idev);
+ rt6_local->rt6i_idev = NULL;
+ }
dst = &rt6_local->dst;
dev_put(dst->dev);
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: vrf: Reset rt6i_idev in local dst after put
2017-03-17 23:07 [PATCH] net: vrf: Reset rt6i_idev in local dst after put David Ahern
@ 2017-03-22 0:51 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-03-22 0:51 UTC (permalink / raw)
To: dsa; +Cc: netdev
From: David Ahern <dsa@cumulusnetworks.com>
Date: Fri, 17 Mar 2017 16:07:11 -0700
> The VRF driver takes a reference to the inet6_dev on the VRF device for
> its rt6_local dst when handling local traffic through the VRF device as
> a loopback. When the device is deleted the driver does a put on the idev
> but does not reset rt6i_idev in the rt6_info struct. When the dst is
> destroyed, dst_destroy calls ip6_dst_destroy which does a second put for
> what is essentially the same reference causing it to be prematurely freed.
> Reset rt6i_idev after the put in the vrf driver.
>
> Fixes: b4869aa2f881e ("net: vrf: ipv6 support for local traffic to
> local addresses")
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-22 1:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-17 23:07 [PATCH] net: vrf: Reset rt6i_idev in local dst after put David Ahern
2017-03-22 0:51 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.