netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@codemonkey.org.uk>
To: David Miller <davem@davemloft.net>
Cc: kraigatgoog@gmail.com, netdev@vger.kernel.org,
	herbert@gondor.apana.org.au
Subject: Re: suspicious RCU usage (netlink/rhashtable)
Date: Tue, 22 Dec 2015 16:54:00 -0500	[thread overview]
Message-ID: <20151222215400.GA14148@codemonkey.org.uk> (raw)
In-Reply-To: <20151222.165020.297576414018581950.davem@davemloft.net>

On Tue, Dec 22, 2015 at 04:50:20PM -0500, David Miller wrote:
 
 > >  > > Simple fix is below.  Though, I don't understand the history of the
 > >  > > multiple locks in this structure to be sure it's correct.  I'll send
 > >  > > it as a formal patch.  Please reject if it's not the right approach.
 > >  > > 
 > >  > > diff --git a/lib/rhashtable.c b/lib/rhashtable.c
 > >  > > index 1c149e9..cc80870 100644
 > >  > > --- a/lib/rhashtable.c
 > >  > > +++ b/lib/rhashtable.c
 > >  > > @@ -516,7 +516,8 @@ int rhashtable_walk_init(struct rhashtable *ht,
 > >  > > struct rhashtable_iter *iter)
 > >  > >                 return -ENOMEM;
 > >  > > 
 > >  > >         spin_lock(&ht->lock);
 > >  > > -       iter->walker->tbl = rht_dereference(ht->tbl, ht);
 > >  > > +       iter->walker->tbl =
 > >  > > +               rcu_dereference_protected(ht->tbl, lockdep_is_held(&ht->lock));
 > >  > >         list_add(&iter->walker->list, &iter->walker->tbl->walkers);
 > >  > >         spin_unlock(&ht->lock);
 > >  > 
 > >  > How can this be the "fix"?  That's exactly what's in the tree.
 > > 
 > > I should have made clear, this is Linus' tree I'm hitting this on,
 > > which matches what Craig posted.
 > 
 > Ok, so this should be fixed in my 'net' tree and I'll send that to Linus
 > soon.

Great, thanks Dave.  Sorry for the fire-alarm :)

	Dave

  reply	other threads:[~2015-12-22 21:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 20:51 suspicious RCU usage (netlink/rhashtable) Craig Gallek
2015-12-22 21:28 ` David Miller
2015-12-22 21:38   ` Craig Gallek
2015-12-22 21:42     ` David Miller
2015-12-22 21:46       ` Craig Gallek
2015-12-22 21:47       ` Dave Jones
2015-12-22 21:50         ` David Miller
2015-12-22 21:54           ` Dave Jones [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-12-22 20:45 Dave Jones
2015-12-22 20:51 ` David Miller

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=20151222215400.GA14148@codemonkey.org.uk \
    --to=davej@codemonkey.org.uk \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kraigatgoog@gmail.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).