diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2017-03-17 16:07:11 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-30 09:41:21 +0200 |
commit | 4e7c821b686231571adaa9af3d7caa88f4ae08cb (patch) | |
tree | 9afcfced384f05ca3420cac4e2284bef8a4c68f8 /drivers/net/vrf.c | |
parent | 4b9b7f17bab1a3cd930320cc1abcf0dce5bac5d4 (diff) |
net: vrf: Reset rt6i_idev in local dst after put
[ Upstream commit 3dc857f0e8fc22610a59cbb346ba62c6e921863f ]
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/vrf.c')
-rw-r--r-- | drivers/net/vrf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index bc744acabf98..a2afb8ecb5bc 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -467,8 +467,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); |