Commit 80e8921b authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net: add net device refcount tracker to struct netdev_rx_queue

This helps debugging net device refcount leaks.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 4d92b95f
...@@ -741,6 +741,8 @@ struct netdev_rx_queue { ...@@ -741,6 +741,8 @@ struct netdev_rx_queue {
#endif #endif
struct kobject kobj; struct kobject kobj;
struct net_device *dev; struct net_device *dev;
netdevice_tracker dev_tracker;
#ifdef CONFIG_XDP_SOCKETS #ifdef CONFIG_XDP_SOCKETS
struct xsk_buff_pool *pool; struct xsk_buff_pool *pool;
#endif #endif
......
...@@ -1004,7 +1004,7 @@ static void rx_queue_release(struct kobject *kobj) ...@@ -1004,7 +1004,7 @@ static void rx_queue_release(struct kobject *kobj)
#endif #endif
memset(kobj, 0, sizeof(*kobj)); memset(kobj, 0, sizeof(*kobj));
dev_put(queue->dev); dev_put_track(queue->dev, &queue->dev_tracker);
} }
static const void *rx_queue_namespace(struct kobject *kobj) static const void *rx_queue_namespace(struct kobject *kobj)
...@@ -1044,7 +1044,7 @@ static int rx_queue_add_kobject(struct net_device *dev, int index) ...@@ -1044,7 +1044,7 @@ static int rx_queue_add_kobject(struct net_device *dev, int index)
/* Kobject_put later will trigger rx_queue_release call which /* Kobject_put later will trigger rx_queue_release call which
* decreases dev refcount: Take that reference here * decreases dev refcount: Take that reference here
*/ */
dev_hold(queue->dev); dev_hold_track(queue->dev, &queue->dev_tracker, GFP_KERNEL);
kobj->kset = dev->queues_kset; kobj->kset = dev->queues_kset;
error = kobject_init_and_add(kobj, &rx_queue_ktype, NULL, error = kobject_init_and_add(kobj, &rx_queue_ktype, NULL,
......
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