diff options
author | Eric Dumazet <edumazet@google.com> | 2021-12-06 21:56:03 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-12-07 10:41:54 -0800 |
commit | c0e5e11af12b76d0dbed700c1088c6827cdcf56c (patch) | |
tree | 029196f72b797cb111ce4cdd25659163b9d18c8a /drivers/net/vrf.c | |
parent | 1c5526968e270e4efccfa1da21d211a4915cdeda (diff) | |
download | lwn-c0e5e11af12b76d0dbed700c1088c6827cdcf56c.tar.gz lwn-c0e5e11af12b76d0dbed700c1088c6827cdcf56c.zip |
vrf: use dev_replace_track() for better tracking
vrf_rt6_release() and vrf_rtable_release() changes dst->dev
Instead of
dev_hold(ndev);
dev_put(odev);
We should use
dev_replace_track(odev, ndev, &dst->dev_tracker, GFP_KERNEL);
If we do not transfer dst->dev_tracker to the new device,
we will get warnings from ref_tracker_dir_exit() when odev
is finally dismantled.
Fixes: 9038c320001d ("net: dst: add net device refcount tracking to dst_entry")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20211207055603.1926372-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/vrf.c')
-rw-r--r-- | drivers/net/vrf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index 131c745dc701..dbfa124d1c1c 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -814,9 +814,9 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf) */ if (rt6) { dst = &rt6->dst; - dev_put(dst->dev); + dev_replace_track(dst->dev, net->loopback_dev, + &dst->dev_tracker, GFP_KERNEL); dst->dev = net->loopback_dev; - dev_hold(dst->dev); dst_release(dst); } } @@ -1061,9 +1061,9 @@ static void vrf_rtable_release(struct net_device *dev, struct net_vrf *vrf) */ if (rth) { dst = &rth->dst; - dev_put(dst->dev); + dev_replace_track(dst->dev, net->loopback_dev, + &dst->dev_tracker, GFP_KERNEL); dst->dev = net->loopback_dev; - dev_hold(dst->dev); dst_release(dst); } } |