mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-18 03:06:43 +00:00
drop_monitor: add net device refcount tracker
We want to track all dev_hold()/dev_put() to ease leak hunting. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
14ed029b5e
commit
4dbd24f65c
@ -664,13 +664,17 @@ struct devlink_health_reporter_ops {
|
||||
* @trap_name: Trap name.
|
||||
* @trap_group_name: Trap group name.
|
||||
* @input_dev: Input netdevice.
|
||||
* @dev_tracker: refcount tracker for @input_dev.
|
||||
* @fa_cookie: Flow action user cookie.
|
||||
* @trap_type: Trap type.
|
||||
*/
|
||||
struct devlink_trap_metadata {
|
||||
const char *trap_name;
|
||||
const char *trap_group_name;
|
||||
|
||||
struct net_device *input_dev;
|
||||
netdevice_tracker dev_tracker;
|
||||
|
||||
const struct flow_action_cookie *fa_cookie;
|
||||
enum devlink_trap_type trap_type;
|
||||
};
|
||||
|
@ -850,7 +850,7 @@ net_dm_hw_metadata_copy(const struct devlink_trap_metadata *metadata)
|
||||
}
|
||||
|
||||
hw_metadata->input_dev = metadata->input_dev;
|
||||
dev_hold(hw_metadata->input_dev);
|
||||
dev_hold_track(hw_metadata->input_dev, &hw_metadata->dev_tracker, GFP_ATOMIC);
|
||||
|
||||
return hw_metadata;
|
||||
|
||||
@ -864,9 +864,9 @@ free_hw_metadata:
|
||||
}
|
||||
|
||||
static void
|
||||
net_dm_hw_metadata_free(const struct devlink_trap_metadata *hw_metadata)
|
||||
net_dm_hw_metadata_free(struct devlink_trap_metadata *hw_metadata)
|
||||
{
|
||||
dev_put(hw_metadata->input_dev);
|
||||
dev_put_track(hw_metadata->input_dev, &hw_metadata->dev_tracker);
|
||||
kfree(hw_metadata->fa_cookie);
|
||||
kfree(hw_metadata->trap_name);
|
||||
kfree(hw_metadata->trap_group_name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user