All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Cong Wang <cwang@twopensource.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>, netdev <netdev@vger.kernel.org>
Subject: Re: [Patch net 2/2] ipmr,ip6mr: call list_del_rcu() when deleting mr table from list
Date: Thu, 26 Mar 2015 02:01:09 +0100	[thread overview]
Message-ID: <1427331669.3644952.245320733.5C7B84E1@webmail.messagingengine.com> (raw)
In-Reply-To: <CAHA+R7Mj7BaVKmmt+0TvUb4a3-mTcP=8_-ZJfxRamOHkjCw-sA@mail.gmail.com>



On Wed, Mar 25, 2015, at 23:33, Cong Wang wrote:
> On Wed, Mar 25, 2015 at 1:56 PM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
> > On Wed, Mar 25, 2015, at 21:21, Hannes Frederic Sowa wrote:
> >> On Wed, Mar 25, 2015, at 21:07, Hannes Frederic Sowa wrote:
> >> > On Wed, Mar 25, 2015, at 20:05, Cong Wang wrote:
> >> > > Probably not a big deal, just for corretness.
> >> > >
> >> > > Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> >> > > ---
> >> > >  net/ipv4/ipmr.c  | 2 +-
> >> > >  net/ipv6/ip6mr.c | 2 +-
> >> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> >> > >
> >> > > diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
> >> > > index d6fede8..68f67b8 100644
> >> > > --- a/net/ipv4/ipmr.c
> >> > > +++ b/net/ipv4/ipmr.c
> >> > > @@ -280,7 +280,7 @@ static void __net_exit ipmr_rules_exit(struct net
> >> > > *net)
> >> > >
> >> > >   rtnl_lock();
> >> > >   list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) {
> >> > > -               list_del(&mrt->list);
> >> > > +               list_del_rcu(&mrt->list);
> >> > >           ipmr_free_table(mrt);
> >> > >   }
> >> > >   rtnl_unlock();
> >> >
> >> > I really do wonder if we have the rcu locking correct in there:
> >> >
> >> > Looking into getsockopt/setsockopt operations, we might have socket
> >> > lock, but I cannot see where we lock rcu, so the ipmr_get_table call is
> >> > safe. Do you also see the problem?
> 
> I see only ipmr_rule_action() really has RCU read lock, I think the
> sockopt
> operations should take RCU read lock too, since it is supposed to be
> protected by rcu+rtnl rather than rcu+sock lock?

Exactly, it would be canonical, especially because of lockdep. I am not
sure yet about socket lock, but will review that tomorrow.

Maybe we also have to add __rcu annotations?

Bye,
Hannes

  reply	other threads:[~2015-03-26  1:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 19:05 [Patch net 1/2] ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup Cong Wang
2015-03-25 19:05 ` [Patch net 2/2] ipmr,ip6mr: call list_del_rcu() when deleting mr table from list Cong Wang
2015-03-25 20:07   ` Hannes Frederic Sowa
2015-03-25 20:21     ` Hannes Frederic Sowa
2015-03-25 20:56       ` Hannes Frederic Sowa
2015-03-25 22:33         ` Cong Wang
2015-03-26  1:01           ` Hannes Frederic Sowa [this message]
2015-03-26 12:23             ` Hannes Frederic Sowa
2015-03-31  0:17               ` Cong Wang
2015-03-25 20:23 ` [Patch net 1/2] ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup Hannes Frederic Sowa

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=1427331669.3644952.245320733.5C7B84E1@webmail.messagingengine.com \
    --to=hannes@stressinduktion.org \
    --cc=cwang@twopensource.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.