[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1441147116.8932.188.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Tue, 01 Sep 2015 15:38:36 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Martin KaFai Lau <kafai@...com>
Cc: netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH net 3/3] ipv6: Fix dst_entry refcnt bugs in ip6_tunnel
On Tue, 2015-09-01 at 15:25 -0700, Martin KaFai Lau wrote:
> On Tue, Sep 01, 2015 at 02:26:58PM -0700, Eric Dumazet wrote:
> > On Tue, 2015-09-01 at 13:55 -0700, Martin KaFai Lau wrote:
> > > On Tue, Sep 01, 2015 at 01:14:20PM -0700, Eric Dumazet wrote:
> > > > It should not be a problem. refcnt is taken when/if necessary (skb
> > > > queued on a qdisc for example)
> > > >
> > > > We have other uses of skb_dst_set_noref()
> > > >
> > > > Please describe the problem ?
> > > The current ip6_tnl_dst_get() does not take the dst refcnt.
> > >
> > > If the dst is released after ip6_tnl_dst_get() and before
> > > skb_dst_set_noref(), would it cause an issue?
> >
> > We are under rcu here, and a dst in a cache is protected by RCU by
> > definition.
> >
> > skb_dst_set_noref() has following debugging clause, does it trigger for
> > you ?
> >
> > WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
> No. I did not see this.
>
> I am probably missing something. Do you mean the rcu can
> protect the followings:
>
>
> ip6_tnl_dst_get()
> dst_release()
> dst_free() /* refcnt is 0 */
> skb_dst_set_noref()
>
Yes, this is protected by normal rcu rules.
dst wont be freed until all cpus exit their rcu read sections.
> --------
>
> or for DST_NOCACHE
>
> ip6_tnl_dst_get()
> dst_release() /* refcnt is 0 */
> skb_dst_set_noref()
> /* ip6tunnel_xmit()
> * or its callees
> * take a dst refcnt
> */
>
> --------
>
> or the above situation does not matter/will not happen?
> --
You should take a look at following commits for a bit of history
10e2eb878f3ca07ac2f05fa5ca5e6c4c9174a27a
dbfc4fb7d578d4f224faa6b60deb40804dfdc1b1
f88649721268999bdff09777847080a52004f691
6c7e7610ff6888ea15a901fbcb30c5d461816b34
--
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