lkml.org 
[lkml]   [2006]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH linux-2.6.17-rc1] net: fix neigh_delete to handle mult. tables
From
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-21 06:20    [W:0.046 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site