Commit 77a23b1f authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net: add net device refcount tracker to struct pneigh_entry

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 85662c9f
......@@ -174,6 +174,7 @@ struct pneigh_entry {
struct pneigh_entry *next;
possible_net_t net;
struct net_device *dev;
netdevice_tracker dev_tracker;
u32 flags;
u8 protocol;
u8 key[];
......
......@@ -771,10 +771,10 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl,
write_pnet(&n->net, net);
memcpy(n->key, pkey, key_len);
n->dev = dev;
dev_hold(dev);
dev_hold_track(dev, &n->dev_tracker, GFP_KERNEL);
if (tbl->pconstructor && tbl->pconstructor(n)) {
dev_put(dev);
dev_put_track(dev, &n->dev_tracker);
kfree(n);
n = NULL;
goto out;
......@@ -806,7 +806,7 @@ int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *pkey,
write_unlock_bh(&tbl->lock);
if (tbl->pdestructor)
tbl->pdestructor(n);
dev_put(n->dev);
dev_put_track(n->dev, &n->dev_tracker);
kfree(n);
return 0;
}
......@@ -839,7 +839,7 @@ static int pneigh_ifdown_and_unlock(struct neigh_table *tbl,
n->next = NULL;
if (tbl->pdestructor)
tbl->pdestructor(n);
dev_put(n->dev);
dev_put_track(n->dev, &n->dev_tracker);
kfree(n);
}
return -ENOENT;
......
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