[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100420204939.GA15354@smudla-wifi.bakulak.kosire.czf>
Date: Tue, 20 Apr 2010 22:49:39 +0200
From: Jiri Bohac <jbohac@...e.cz>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Jiri Bohac <jbohac@...e.cz>, netdev@...r.kernel.org,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
David Miller <davem@...emloft.net>
Subject: Re: IPv6: race condition in __ipv6_ifa_notify() and dst_free() ?
On Tue, Apr 20, 2010 at 07:57:27PM +0200, Eric Dumazet wrote:
> Le mardi 20 avril 2010 à 19:44 +0200, Jiri Bohac a écrit :
> > --- a/net/ipv6/addrconf.c 2010-04-17 00:12:32.000000000 +0200
> > +++ b/net/ipv6/addrconf.c 2010-04-20 19:07:35.000000000 +0200
> > @@ -3974,8 +3974,7 @@ static void __ipv6_ifa_notify(int event,
> > addrconf_leave_anycast(ifp);
> > addrconf_leave_solict(ifp->idev, &ifp->addr);
> > dst_hold(&ifp->rt->u.dst);
> > - if (ip6_del_rt(ifp->rt))
> > - dst_free(&ifp->rt->u.dst);
> > + ip6_del_rt(ifp->rt);
> > break;
> > }
> > }
> >
>
>
> I dont understand the problem Jiri.
>
> We just did dst_hold(&ifp->rt->u.dst), so if ip6_del_rt() fails we must
> dst_free(), or we leak a refcount.
Well, no ... dst_free() does not decrement the refcount.
The "opposite" of dst_hold() is dst_release(). And it does not
automatically call dst_free() when the refcount drops to 0.
dst_free() needs to be called explicitly and it apparently
expects the caller to ensure that two dst_free()s won't be called
simultaneously. But my bonding example shows this is not the
case.
--
Jiri Bohac <jbohac@...e.cz>
SUSE Labs, SUSE CZ
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists