Commit 8c727003 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

ipv6: add net device refcount tracker to struct inet6_dev

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f77159a3
...@@ -160,6 +160,7 @@ struct ipv6_devstat { ...@@ -160,6 +160,7 @@ struct ipv6_devstat {
struct inet6_dev { struct inet6_dev {
struct net_device *dev; struct net_device *dev;
netdevice_tracker dev_tracker;
struct list_head addr_list; struct list_head addr_list;
......
...@@ -405,13 +405,13 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) ...@@ -405,13 +405,13 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
if (ndev->cnf.forwarding) if (ndev->cnf.forwarding)
dev_disable_lro(dev); dev_disable_lro(dev);
/* We refer to the device */ /* We refer to the device */
dev_hold(dev); dev_hold_track(dev, &ndev->dev_tracker, GFP_KERNEL);
if (snmp6_alloc_dev(ndev) < 0) { if (snmp6_alloc_dev(ndev) < 0) {
netdev_dbg(dev, "%s: cannot allocate memory for statistics\n", netdev_dbg(dev, "%s: cannot allocate memory for statistics\n",
__func__); __func__);
neigh_parms_release(&nd_tbl, ndev->nd_parms); neigh_parms_release(&nd_tbl, ndev->nd_parms);
dev_put(dev); dev_put_track(dev, &ndev->dev_tracker);
kfree(ndev); kfree(ndev);
return ERR_PTR(err); return ERR_PTR(err);
} }
......
...@@ -263,7 +263,7 @@ void in6_dev_finish_destroy(struct inet6_dev *idev) ...@@ -263,7 +263,7 @@ void in6_dev_finish_destroy(struct inet6_dev *idev)
#ifdef NET_REFCNT_DEBUG #ifdef NET_REFCNT_DEBUG
pr_debug("%s: %s\n", __func__, dev ? dev->name : "NIL"); pr_debug("%s: %s\n", __func__, dev ? dev->name : "NIL");
#endif #endif
dev_put(dev); dev_put_track(dev, &idev->dev_tracker);
if (!idev->dead) { if (!idev->dead) {
pr_warn("Freeing alive inet6 device %p\n", idev); pr_warn("Freeing alive inet6 device %p\n", idev);
return; return;
......
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