[PATCH] [NET] NEIGHBOUR: hold refcnt of net_device from proxy neighbor entries.
From: YOSHIFUJI Hideaki / 吉藤英明 <hidden>
Date: 2004-09-30 08:07:29
Hello. [NET] NEIGHBOUR: hold refcnt of net_device from proxy neighbor entries. We did not hold refcnt of net_device from proxy neighbor entries while we did from neighbor entries. Signed-off-by: Hideaki YOSHIFUJI <redacted> Thanks. diff -Nru a/net/core/neighbour.c b/net/core/neighbour.c
--- a/net/core/neighbour.c 2004-09-30 16:32:24 +09:00
+++ b/net/core/neighbour.c 2004-09-30 16:32:24 +09:00@@ -496,8 +496,12 @@ 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 @@ 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 @@ *np = n->next; if (tbl->pdestructor) tbl->pdestructor(n); + if (n->dev) + dev_put(n->dev); kfree(n); continue; }
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA