netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <kafai@fb.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH net 3/3] ipv6: Fix dst_entry refcnt bugs in ip6_tunnel
Date: Wed, 2 Sep 2015 13:58:02 -0700	[thread overview]
Message-ID: <20150902205802.GA78846@kafai-mba.local> (raw)
In-Reply-To: <1441138460.8932.182.camel@edumazet-glaptop2.roam.corp.google.com>

On Tue, Sep 01, 2015 at 01:14:20PM -0700, Eric Dumazet wrote:
> > 2. Use a spinlock to protect the dst_cache operations
>
> Well, a seqlock would be better : No need for an atomic operation in
> fast path.
>
seqlock can ensure consistency between idst->dst and idst->cookie.
However, IPv6 dst destruction is not protected by rcu.  dst_free() is
directly called, like in ip6_fib.c and a few other places.
Hence, atomic_inc_not_zero() cannot be used here because the dst may
have already been kmem_cache_free() when refcnt is 0.  A spinlock is
needed to stop the ip6_tnl_dst_set() side from removing the refcnt.

  parent reply	other threads:[~2015-09-02 20:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 18:55 [PATCH net 0/3] ipv6: Fix dst_entry refcnt bugs in ip6_tunnel Martin KaFai Lau
2015-09-01 18:55 ` [PATCH net 1/3] ipv6: Refactor common ip6gre_tunnel_init codes Martin KaFai Lau
2015-09-01 18:55 ` [PATCH net 2/3] ipv6: Rename the dst_cache helper functions in ip6_tunnel Martin KaFai Lau
2015-09-01 18:55 ` [PATCH net 3/3] ipv6: Fix dst_entry refcnt bugs " Martin KaFai Lau
2015-09-01 20:14   ` Eric Dumazet
2015-09-01 20:55     ` Martin KaFai Lau
2015-09-01 21:26       ` Eric Dumazet
2015-09-01 22:25         ` Martin KaFai Lau
2015-09-01 22:38           ` Eric Dumazet
2015-09-02  0:31             ` Martin KaFai Lau
2015-09-02  0:42               ` Martin KaFai Lau
2015-09-02  1:02                 ` Martin KaFai Lau
2015-09-02  1:55     ` Martin KaFai Lau
2015-09-02 20:58     ` Martin KaFai Lau [this message]
2015-09-02 21:30       ` Eric Dumazet
2015-09-02 21:52         ` Martin KaFai Lau
2015-09-02 22:48           ` Eric Dumazet
2015-09-02 23:04             ` David Miller
2015-09-02 23:10             ` Martin KaFai Lau
2015-09-02 23:14               ` David Miller
2015-09-02 23:46               ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150902205802.GA78846@kafai-mba.local \
    --to=kafai@fb.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).