netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: davem@davemloft.net
Cc: netdev@oss.sgi.com
Subject: [PATCH] [NET] NEIGHBOUR: hold refcnt of net_device from proxy neighbor entries.
Date: Thu, 30 Sep 2004 17:07:29 +0900 (JST)	[thread overview]
Message-ID: <20040930.170729.51800585.yoshfuji@linux-ipv6.org> (raw)

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 <yoshfuji@linux-ipv6.org>

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

             reply	other threads:[~2004-09-30  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-30  8:07 YOSHIFUJI Hideaki / 吉藤英明 [this message]
2004-10-01 22:17 ` [PATCH] [NET] NEIGHBOUR: hold refcnt of net_device from proxy neighbor entries David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040930.170729.51800585.yoshfuji@linux-ipv6.org \
    --to=yoshfuji@linux-ipv6.org \
    --cc=davem@davemloft.net \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).