[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1406156078.3363.20.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 24 Jul 2014 00:54:38 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: steffen.klassert@...unet.com, herbert@...dor.apana.org.au,
netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] xfrm: Fix refcount imbalance in xfrm_lookup
On Wed, 2014-07-23 at 15:09 -0700, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@...il.com>
> > Hmm... are you sure ?
> >
> > Before 1a1ccc96abb we did a dst_hold() because we kept the dst in
> > xfrm_policy_sk_bundles. So keeping a reference count was mandatory.
> >
> > But after, I don't understand why it is needed at all.
>
> It should be needed.
>
> We create a new bundle here, from scratch, based upon the socket
> policy.
>
> Such new bundles make routes with dst refcount == 0.
>
> All callers expect that the route given back to them is either
> the original 'dst' passed into xfrm_lookup() unmolested, or a
> new 'dst' having a refcount taken for this caller.
>
> That's why all call sites expect that they can just go
> "dst_release(dst)" and these objects it works.
>
> So, if we returned 'dst' with refcount == 0 it would not work.
OK, I understood, thanks !
--
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