]> git.hungrycats.org Git - linux/commitdiff
[IPV6]: NEIGHBOUR: hold refcnt of net_device from proxy neighbor entries.
authorHideaki Yoshifuji <yoshfuji@linux-ipv6.org>
Fri, 1 Oct 2004 07:58:40 +0000 (00:58 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Fri, 1 Oct 2004 07:58:40 +0000 (00:58 -0700)
Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c

index a5509ef5570ed46a48857cc1e3aca2ba81e74d9a..c18ca715f8fc6bd65b23c6da050b92df03ae7522 100644 (file)
@@ -496,8 +496,12 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, const void *pkey,
 
        memcpy(n->key, pkey, key_len);
        n->dev = dev;
+       if (dev)
+               dev_hold(dev);
 
        if (tbl->pconstructor && tbl->pconstructor(n)) {
+               if (dev)
+                       dev_put(dev);
                kfree(n);
                n = NULL;
                goto out;
@@ -532,6 +536,8 @@ int pneigh_delete(struct neigh_table *tbl, const void *pkey,
                        write_unlock_bh(&tbl->lock);
                        if (tbl->pdestructor)
                                tbl->pdestructor(n);
+                       if (n->dev)
+                               dev_put(n->dev);
                        kfree(n);
                        return 0;
                }
@@ -552,6 +558,8 @@ static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev)
                                *np = n->next;
                                if (tbl->pdestructor)
                                        tbl->pdestructor(n);
+                               if (n->dev)
+                                       dev_put(n->dev);
                                kfree(n);
                                continue;
                        }