summaryrefslogtreecommitdiff
path: root/net/switchdev
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-12-06 17:30:31 -0800
committerJakub Kicinski <kuba@kernel.org>2021-12-07 20:44:58 -0800
commit4fc003fe0313276f0d4ea996ab9b4acd9a5a5e93 (patch)
tree2e4db68bd10090f6cbf168f97a01e1784257b408 /net/switchdev
parentf12bf6f3f942b37de65eeea8be25903587fec930 (diff)
net: switchdev: add net device refcount tracker
Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/switchdev')
-rw-r--r--net/switchdev/switchdev.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 83460470e883..b62565278fac 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -28,6 +28,7 @@ typedef void switchdev_deferred_func_t(struct net_device *dev,
struct switchdev_deferred_item {
struct list_head list;
struct net_device *dev;
+ netdevice_tracker dev_tracker;
switchdev_deferred_func_t *func;
unsigned long data[];
};
@@ -63,7 +64,7 @@ void switchdev_deferred_process(void)
while ((dfitem = switchdev_deferred_dequeue())) {
dfitem->func(dfitem->dev, dfitem->data);
- dev_put(dfitem->dev);
+ dev_put_track(dfitem->dev, &dfitem->dev_tracker);
kfree(dfitem);
}
}
@@ -90,7 +91,7 @@ static int switchdev_deferred_enqueue(struct net_device *dev,
dfitem->dev = dev;
dfitem->func = func;
memcpy(dfitem->data, data, data_len);
- dev_hold(dev);
+ dev_hold_track(dev, &dfitem->dev_tracker, GFP_ATOMIC);
spin_lock_bh(&deferred_lock);
list_add_tail(&dfitem->list, &deferred);
spin_unlock_bh(&deferred_lock);