Commit 85662c9f authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net: add net device refcount tracker to struct neighbour

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 56c1c779
...@@ -158,6 +158,7 @@ struct neighbour { ...@@ -158,6 +158,7 @@ struct neighbour {
struct list_head managed_list; struct list_head managed_list;
struct rcu_head rcu; struct rcu_head rcu;
struct net_device *dev; struct net_device *dev;
netdevice_tracker dev_tracker;
u8 primary_key[0]; u8 primary_key[0];
} __randomize_layout; } __randomize_layout;
......
...@@ -624,7 +624,7 @@ ___neigh_create(struct neigh_table *tbl, const void *pkey, ...@@ -624,7 +624,7 @@ ___neigh_create(struct neigh_table *tbl, const void *pkey,
memcpy(n->primary_key, pkey, key_len); memcpy(n->primary_key, pkey, key_len);
n->dev = dev; n->dev = dev;
dev_hold(dev); dev_hold_track(dev, &n->dev_tracker, GFP_ATOMIC);
/* Protocol specific setup. */ /* Protocol specific setup. */
if (tbl->constructor && (error = tbl->constructor(n)) < 0) { if (tbl->constructor && (error = tbl->constructor(n)) < 0) {
...@@ -880,7 +880,7 @@ void neigh_destroy(struct neighbour *neigh) ...@@ -880,7 +880,7 @@ void neigh_destroy(struct neighbour *neigh)
if (dev->netdev_ops->ndo_neigh_destroy) if (dev->netdev_ops->ndo_neigh_destroy)
dev->netdev_ops->ndo_neigh_destroy(dev, neigh); dev->netdev_ops->ndo_neigh_destroy(dev, neigh);
dev_put(dev); dev_put_track(dev, &neigh->dev_tracker);
neigh_parms_put(neigh->parms); neigh_parms_put(neigh->parms);
neigh_dbg(2, "neigh %p is destroyed\n", neigh); neigh_dbg(2, "neigh %p is destroyed\n", neigh);
......
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