[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1389922142.31367.445.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 16 Jan 2014 17:29:02 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org, therbert@...gle.com, maze@...gle.com,
cwang@...pensource.com
Subject: Re: [PATCH net-next] ipv4: fix a dst leak in tunnels
On Thu, 2014-01-16 at 17:13 -0800, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@...il.com>
> Date: Thu, 16 Jan 2014 16:41:19 -0800
>
> > This patch :
> >
> > 1) Remove a dst leak if DST_NOCACHE was set on dst
> > Fix this by holding a reference only if dst really cached.
>
> Can you explain this problem a little bit more?
>
> Why do we have to handle DST_NOCACHE specially? We hold a reference
> and dst_release() knows what to do with DST_NOCACHE routes.
>
> Or is it semantically undesirable for tunnels to cache these routes?
> If so, why do we leave sockets caching DST_NOCACHE routes just fine?
Previous code was doing in the callers of __tunnel_dst_set() a
dst_clone(dst)
Then, we were doing in __tunnel_dst_set() :
if (dst && (dst->flags & DST_NOCACHE))
dst = NULL;
When setting dst to NULL here, we forgot to release the reference we
took in callers.
After my patch, we instead do the dst_clone(dst) only in the case we are
not clearing dst :
+ if (dst) {
+ if (dst->flags & DST_NOCACHE)
+ dst = NULL;
+ else
+ dst_clone(dst);
+ }
--
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