Skip to content

Commit

Permalink
mlxsw: spectrum_router: IPv6 events: Use tracker helpers to hold & pu…
Browse files Browse the repository at this point in the history
…t netdevices

Using the tracking helpers makes it easier to debug netdevice refcount
imbalances when CONFIG_NET_DEV_REFCNT_TRACKER is enabled.

Convert dev_hold() / dev_put() to netdev_hold() / netdev_put() in the
router code that deals with IPv6 address events.

Signed-off-by: Petr Machata <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://lore.kernel.org/r/f0af6ad4722b4ca6e598fd4fda8311a3041651ec.1690471775.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
pmachata authored and kuba-moo committed Jul 28, 2023
1 parent d0e0e88 commit cb21162
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -9333,6 +9333,7 @@ struct mlxsw_sp_inet6addr_event_work {
struct work_struct work;
struct mlxsw_sp *mlxsw_sp;
struct net_device *dev;
netdevice_tracker dev_tracker;
unsigned long event;
};

Expand All @@ -9356,7 +9357,7 @@ static void mlxsw_sp_inet6addr_event_work(struct work_struct *work)
out:
mutex_unlock(&mlxsw_sp->router->lock);
rtnl_unlock();
dev_put(dev);
netdev_put(dev, &inet6addr_work->dev_tracker);
kfree(inet6addr_work);
}

Expand All @@ -9382,7 +9383,7 @@ static int mlxsw_sp_inet6addr_event(struct notifier_block *nb,
inet6addr_work->mlxsw_sp = router->mlxsw_sp;
inet6addr_work->dev = dev;
inet6addr_work->event = event;
dev_hold(dev);
netdev_hold(dev, &inet6addr_work->dev_tracker, GFP_ATOMIC);
mlxsw_core_schedule_work(&inet6addr_work->work);

return NOTIFY_DONE;
Expand Down

0 comments on commit cb21162

Please sign in to comment.