From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: opendon@donlaw.com
Cc: davem@davemloft.net, kuznet@ms2.inr.ac.ru, pekkas@netcore.fi,
jmorris@namei.org, kaber@coreworks.de,
linux-kernel@vger.kernel.org, yoshfuji@linux-ipv6.org
Subject: Re: [PATCH linux-2.6.17-rc1] net: fix neigh_delete to handle mult. tables
Date: Fri, 21 Apr 2006 13:20:38 +0900 (JST) [thread overview]
Message-ID: <20060421.132038.80416538.yoshfuji@linux-ipv6.org> (raw)
In-Reply-To: <20060421.125543.126764691.yoshfuji@linux-ipv6.org>
In article <20060421.125543.126764691.yoshfuji@linux-ipv6.org> (at Fri, 21 Apr 2006 12:55:43 +0900 (JST)), YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> says:
> In article <4448520C.5080508@donlaw.com> (at Thu, 20 Apr 2006 23:31:24 -0400), Don Law <opendon@donlaw.com> says:
>
> > One side effect of this change is that neigh_lookup is now called while
> > a read lock is held on neigh_tbl_lock. neigh_lookup does take read
> > locks on the tbl->lock set. However, this does not introduce any new lock
> > order dependencies, since we already have that precedent set in the
> > neightbl_set function.
>
> I don't think this is good change.
>
> What you need to fix your problem is to remove the last
> "goto out_dev_put;" isn't it?
Hmm, okay, I notice we need to hold lock for pneigh_delete().
How about this? Also handles proxy neighbors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 4cf878e..fa3227a 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1430,6 +1430,8 @@ int neigh_delete(struct sk_buff *skb, st
(dev = dev_get_by_index(ndm->ndm_ifindex)) == NULL)
goto out;
+ err = -EADDRNOTAVAIL;
+
read_lock(&neigh_tbl_lock);
for (tbl = neigh_tables; tbl; tbl = tbl->next) {
struct rtattr *dst_attr = nda[NDA_DST - 1];
@@ -1437,32 +1439,33 @@ int neigh_delete(struct sk_buff *skb, st
if (tbl->family != ndm->ndm_family)
continue;
- read_unlock(&neigh_tbl_lock);
- err = -EINVAL;
- if (!dst_attr || RTA_PAYLOAD(dst_attr) < tbl->key_len)
- goto out_dev_put;
+ if (!dst_attr || RTA_PAYLOAD(dst_attr) < tbl->key_len) {
+ err = -EINVAL;
+ break;
+ }
if (ndm->ndm_flags & NTF_PROXY) {
- err = pneigh_delete(tbl, RTA_DATA(dst_attr), dev);
- goto out_dev_put;
+ if (!pneigh_delete(tbl, RTA_DATA(dst_attr), dev)) {
+ read_unlock(&neigh_tbl_lock);
+ break;
+ }
}
if (!dev)
- goto out;
+ continue;
n = neigh_lookup(tbl, RTA_DATA(dst_attr), dev);
if (n) {
+ read_unlock(&neigh_tbl_lock);
err = neigh_update(n, NULL, NUD_FAILED,
NEIGH_UPDATE_F_OVERRIDE|
NEIGH_UPDATE_F_ADMIN);
neigh_release(n);
+ break;
}
- goto out_dev_put;
}
read_unlock(&neigh_tbl_lock);
- err = -EADDRNOTAVAIL;
-out_dev_put:
if (dev)
dev_put(dev);
out:
--
YOSHIFUJI Hideaki @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
next prev parent reply other threads:[~2006-04-21 4:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-21 3:31 Don Law
2006-04-21 3:55 ` YOSHIFUJI Hideaki / 吉藤英明
2006-04-21 4:20 ` YOSHIFUJI Hideaki / 吉藤英明 [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-04-14 3:42 Don Law
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=20060421.132038.80416538.yoshfuji@linux-ipv6.org \
--to=yoshfuji@linux-ipv6.org \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@coreworks.de \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=opendon@donlaw.com \
--cc=pekkas@netcore.fi \
/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
all inboxes | Powered by JetHome®