From 7ff74a596b6aa47ccc71f6b9a26006af69d0e33f Mon Sep 17 00:00:00 2001 From: =?utf8?q?YOSHIFUJI=20Hideaki=20/=20=E5=90=89=E8=97=A4=E8=8B=B1?= =?utf8?q?=E6=98=8E?= Date: Thu, 17 Jan 2013 12:53:02 +0000 Subject: [PATCH] ndisc: Update neigh->updated with write lock. neigh->nud_state and neigh->updated are under protection of neigh->lock. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- 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 7c34c01b515b..1341f68e8009 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 -- 2.30.2