Commit 66ce07f7 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

ax25: add net device refcount tracker

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e44b14eb
...@@ -229,7 +229,10 @@ struct ctl_table; ...@@ -229,7 +229,10 @@ struct ctl_table;
typedef struct ax25_dev { typedef struct ax25_dev {
struct ax25_dev *next; struct ax25_dev *next;
struct net_device *dev; struct net_device *dev;
netdevice_tracker dev_tracker;
struct net_device *forward; struct net_device *forward;
struct ctl_table_header *sysheader; struct ctl_table_header *sysheader;
int values[AX25_MAX_VALUES]; int values[AX25_MAX_VALUES];
......
...@@ -58,7 +58,7 @@ void ax25_dev_device_up(struct net_device *dev) ...@@ -58,7 +58,7 @@ void ax25_dev_device_up(struct net_device *dev)
dev->ax25_ptr = ax25_dev; dev->ax25_ptr = ax25_dev;
ax25_dev->dev = dev; ax25_dev->dev = dev;
dev_hold(dev); dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_ATOMIC);
ax25_dev->forward = NULL; ax25_dev->forward = NULL;
ax25_dev->values[AX25_VALUES_IPDEFMODE] = AX25_DEF_IPDEFMODE; ax25_dev->values[AX25_VALUES_IPDEFMODE] = AX25_DEF_IPDEFMODE;
...@@ -114,7 +114,7 @@ void ax25_dev_device_down(struct net_device *dev) ...@@ -114,7 +114,7 @@ void ax25_dev_device_down(struct net_device *dev)
ax25_dev_list = s->next; ax25_dev_list = s->next;
spin_unlock_bh(&ax25_dev_lock); spin_unlock_bh(&ax25_dev_lock);
dev->ax25_ptr = NULL; dev->ax25_ptr = NULL;
dev_put(dev); dev_put_track(dev, &ax25_dev->dev_tracker);
kfree(ax25_dev); kfree(ax25_dev);
return; return;
} }
...@@ -124,7 +124,7 @@ void ax25_dev_device_down(struct net_device *dev) ...@@ -124,7 +124,7 @@ void ax25_dev_device_down(struct net_device *dev)
s->next = ax25_dev->next; s->next = ax25_dev->next;
spin_unlock_bh(&ax25_dev_lock); spin_unlock_bh(&ax25_dev_lock);
dev->ax25_ptr = NULL; dev->ax25_ptr = NULL;
dev_put(dev); dev_put_track(dev, &ax25_dev->dev_tracker);
kfree(ax25_dev); kfree(ax25_dev);
return; return;
} }
...@@ -188,7 +188,7 @@ void __exit ax25_dev_free(void) ...@@ -188,7 +188,7 @@ void __exit ax25_dev_free(void)
ax25_dev = ax25_dev_list; ax25_dev = ax25_dev_list;
while (ax25_dev != NULL) { while (ax25_dev != NULL) {
s = ax25_dev; s = ax25_dev;
dev_put(ax25_dev->dev); dev_put_track(ax25_dev->dev, &ax25_dev->dev_tracker);
ax25_dev = ax25_dev->next; ax25_dev = ax25_dev->next;
kfree(s); kfree(s);
} }
......
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