Commit c0e5e11a authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

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: 9038c320 ("net: dst: add net device refcount tracking to dst_entry")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20211207055603.1926372-1-eric.dumazet@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1c552696
...@@ -814,9 +814,9 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf) ...@@ -814,9 +814,9 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf)
*/ */
if (rt6) { if (rt6) {
dst = &rt6->dst; 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; dst->dev = net->loopback_dev;
dev_hold(dst->dev);
dst_release(dst); dst_release(dst);
} }
} }
...@@ -1061,9 +1061,9 @@ static void vrf_rtable_release(struct net_device *dev, struct net_vrf *vrf) ...@@ -1061,9 +1061,9 @@ static void vrf_rtable_release(struct net_device *dev, struct net_vrf *vrf)
*/ */
if (rth) { if (rth) {
dst = &rth->dst; 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; dst->dev = net->loopback_dev;
dev_hold(dst->dev);
dst_release(dst); dst_release(dst);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment