Commit af18a4b8 authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji Committed by David S. Miller

[IPV6]: NEIGHBOUR: hold refcnt of net_device from proxy neighbor entries.

Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 01b78182
...@@ -496,8 +496,12 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, const void *pkey, ...@@ -496,8 +496,12 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, const void *pkey,
memcpy(n->key, pkey, key_len); memcpy(n->key, pkey, key_len);
n->dev = dev; n->dev = dev;
if (dev)
dev_hold(dev);
if (tbl->pconstructor && tbl->pconstructor(n)) { if (tbl->pconstructor && tbl->pconstructor(n)) {
if (dev)
dev_put(dev);
kfree(n); kfree(n);
n = NULL; n = NULL;
goto out; goto out;
...@@ -532,6 +536,8 @@ int pneigh_delete(struct neigh_table *tbl, const void *pkey, ...@@ -532,6 +536,8 @@ int pneigh_delete(struct neigh_table *tbl, const void *pkey,
write_unlock_bh(&tbl->lock); write_unlock_bh(&tbl->lock);
if (tbl->pdestructor) if (tbl->pdestructor)
tbl->pdestructor(n); tbl->pdestructor(n);
if (n->dev)
dev_put(n->dev);
kfree(n); kfree(n);
return 0; return 0;
} }
...@@ -552,6 +558,8 @@ static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev) ...@@ -552,6 +558,8 @@ static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev)
*np = n->next; *np = n->next;
if (tbl->pdestructor) if (tbl->pdestructor)
tbl->pdestructor(n); tbl->pdestructor(n);
if (n->dev)
dev_put(n->dev);
kfree(n); kfree(n);
continue; continue;
} }
......
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