From patchwork Thu Jan 17 17:41:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [net-next,01/11] ndisc: Update neigh->updated with write lock. X-Patchwork-Submitter: =?utf-8?b?WU9TSElGVUpJIEhpZGVha2kgLyDlkInol6Toi7HmmI4=?= X-Patchwork-Id: 213330 X-Patchwork-Delegate: davem@davemloft.net Message-Id: <50F837DD.9020005@linux-ipv6.org> To: davem@davemloft.net, netdev@vger.kernel.org Cc: yoshfuji@linux-ipv6.org, xiyou.wangcong@gmail.com Date: Fri, 18 Jan 2013 02:41:49 +0900 From: YOSHIFUJI Hideaki List-Id: neigh->nud_state and neigh->updated are under protection of neigh->lock. Signed-off-by: YOSHIFUJI Hideaki --- net/ipv6/route.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 7c34c01..1341f68 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -499,22 +499,26 @@ static void rt6_probe(struct rt6_info *rt) * to no more than one per minute. */ neigh = rt ? rt->n : NULL; - if (!neigh || (neigh->nud_state & NUD_VALID)) + if (!neigh) + return; + write_lock_bh(&neigh->lock); + if (neigh->nud_state & NUD_VALID) { + write_unlock_bh(&neigh->lock); return; - read_lock_bh(&neigh->lock); + } if (!(neigh->nud_state & NUD_VALID) && time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) { struct in6_addr mcaddr; struct in6_addr *target; neigh->updated = jiffies; - read_unlock_bh(&neigh->lock); + write_unlock_bh(&neigh->lock); target = (struct in6_addr *)&neigh->primary_key; addrconf_addr_solict_mult(target, &mcaddr); ndisc_send_ns(rt->dst.dev, NULL, target, &mcaddr, NULL); } else { - read_unlock_bh(&neigh->lock); + write_unlock_bh(&neigh->lock); } } #else