mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
net: add net device refcount tracker to struct pneigh_entry
Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
85662c9f8c
commit
77a23b1f95
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user