netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6: fix race between ipv6_del_addr and DAD timer
@ 2008-07-08  8:55 Pavel Emelyanov
  2008-07-08 22:14 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2008-07-08  8:55 UTC (permalink / raw)
  To: David Miller, YOSHIFUJI Hideaki; +Cc: Linux Netdev List, Andrey Vagin

From: Andrey Vagin <avagin@parallels.com>

Consider the following scenario:

ipv6_del_addr(ifp)
  ipv6_ifa_notify(RTM_DELADDR, ifp)
    ip6_del_rt(ifp->rt)

after returning from the ipv6_ifa_notify and enabling BH-s
back, but *before* calling the addrconf_del_timer the 
ifp->timer fires and:

addrconf_dad_timer(ifp)
  addrconf_dad_completed(ifp)
    ipv6_ifa_notify(RTM_NEWADDR, ifp)
      ip6_ins_rt(ifp->rt)

then return back to the ipv6_del_addr and:

in6_ifa_put(ifp)
  inet6_ifa_finish_destroy(ifp)
    dst_release(&ifp->rt->u.dst)

After this we have an ifp->rt inserted into fib6 lists, but 
queued for gc, which in turn can result in oopses in the
fib6_run_gc. Maybe some other nasty things, but we caught 
only the oops in gc so far.

The solution is to disarm the ifp->timer before flushing the
rt from it.

Signed-off-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 147588f..ff61a5c 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -749,12 +749,12 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
 	}
 	write_unlock_bh(&idev->lock);
 
+	addrconf_del_timer(ifp);
+
 	ipv6_ifa_notify(RTM_DELADDR, ifp);
 
 	atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifp);
 
-	addrconf_del_timer(ifp);
-
 	/*
 	 * Purge or update corresponding prefix
 	 *

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipv6: fix race between ipv6_del_addr and DAD timer
  2008-07-08  8:55 [PATCH] ipv6: fix race between ipv6_del_addr and DAD timer Pavel Emelyanov
@ 2008-07-08 22:14 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-07-08 22:14 UTC (permalink / raw)
  To: xemul; +Cc: yoshfuji, netdev, avagin

From: Pavel Emelyanov <xemul@openvz.org>
Date: Tue, 08 Jul 2008 12:55:24 +0400

> Consider the following scenario:
> 
> ipv6_del_addr(ifp)
>   ipv6_ifa_notify(RTM_DELADDR, ifp)
>     ip6_del_rt(ifp->rt)
> 
> after returning from the ipv6_ifa_notify and enabling BH-s
> back, but *before* calling the addrconf_del_timer the 
> ifp->timer fires and:
> 
> addrconf_dad_timer(ifp)
>   addrconf_dad_completed(ifp)
>     ipv6_ifa_notify(RTM_NEWADDR, ifp)
>       ip6_ins_rt(ifp->rt)
> 
> then return back to the ipv6_del_addr and:
> 
> in6_ifa_put(ifp)
>   inet6_ifa_finish_destroy(ifp)
>     dst_release(&ifp->rt->u.dst)
> 
> After this we have an ifp->rt inserted into fib6 lists, but 
> queued for gc, which in turn can result in oopses in the
> fib6_run_gc. Maybe some other nasty things, but we caught 
> only the oops in gc so far.
> 
> The solution is to disarm the ifp->timer before flushing the
> rt from it.
> 
> Signed-off-by: Andrey Vagin <avagin@parallels.com>
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied to net-2.6, thanks a lot for this bug fix!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-08 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08  8:55 [PATCH] ipv6: fix race between ipv6_del_addr and DAD timer Pavel Emelyanov
2008-07-08 22:14 ` David Miller

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).