From: Eric Dumazet <eric.dumazet@gmail.com>
To: paulmck@linux.vnet.ibm.com
Cc: Minchan Kim <minchan.kim@gmail.com>,
gerald.schaefer@de.ibm.com,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Milton Miller <miltonm@bga.com>,
linux-kernel@vger.kernel.org, linux-mm@vger.kernel.org,
linux-ext4@vger.kernel.org, Ted Ts'o <tytso@mit.edu>,
Arun Bhanu <ab@arunbhanu.com>, Mel Gorman <mel@csn.ul.ie>,
Andrew Morton <akpm@linux-foundation.org>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [BUG?] memory hotplug: include/linux/radix-tree.h:145 invoked rcu_dereference_check() without protection!
Date: Fri, 17 Dec 2010 06:59:01 +0100 [thread overview]
Message-ID: <1292565541.2655.28.camel@edumazet-laptop> (raw)
In-Reply-To: <20101217054722.GG2253@linux.vnet.ibm.com>
Le jeudi 16 décembre 2010 à 21:47 -0800, Paul E. McKenney a écrit :
> On Fri, Dec 17, 2010 at 09:04:13AM +0900, Minchan Kim wrote:
> > How about this?
> > Maybe Paul have better idea.
> > (It's apparently be word-wrapped.)
> >
> > diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
> > index ab2baa5..135af1e 100644
> > --- a/include/linux/radix-tree.h
> > +++ b/include/linux/radix-tree.h
> > @@ -146,6 +146,20 @@ static inline void *radix_tree_deref_slot(void **pslot)
> > }
> >
> > /**
> > + * radix_tree_deref_slot_nocheck - dereference a slot without RCU check
> > + * @pslot: pointer to slot, returned by radix_tree_lookup_slot
> > + * Returns: item that was stored in that slot with any direct pointer flag
> > + * removed.
> > + *
> > + * This functions works like radix_tree_deref_slot except it doesn't check
> > + * RCU rule. Normally this funcion is used with update-side lock.
> > + * You should use this function very carefully.
> > + */
> > +static inline void *radix_tree_deref_slot_nocheck(void **pslot)
> > +{
> > + return rcu_dereference_protected(*pslot, 1);
>
> I suggest replacing the "1" with lockdep expressions for the locks
> that you say might be held:
>
> return rcu_dereference_check(*pslot,
> lockdep_is_held(&mapping->tree_lock));
>
Yes, but point was also to use rcu_dereference_protected() here, not
rcu_dereference_check().
> This assumes that when you said "and" you meant both lock_page() and
> mapping->tree_lock. Also you need to pass in the mapping, which
> should not be a problem given likely inlining.
>
> If you meant that either mapping->tree_lock or page_lock() might be
> held, I suppose that the page_lock() state could be passed in, but
> perhaps better to take a general lockdep expression.
>
> So, either or both? ;-)
>
Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-12-17 5:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-21 11:26 [BUG?] [Ext4] INFO: suspicious rcu_dereference_check() usage Arun Bhanu
2010-11-21 13:30 ` Ted Ts'o
2010-11-21 15:39 ` Minchan Kim
2010-11-21 17:37 ` Ted Ts'o
2010-11-22 0:38 ` Minchan Kim
2010-11-22 3:31 ` Milton Miller
2010-11-22 6:16 ` Paul E. McKenney
2010-12-07 19:01 ` [BUG?] memory hotplug: include/linux/radix-tree.h:145 invoked rcu_dereference_check() without protection! Gerald Schaefer
2010-12-08 1:19 ` KAMEZAWA Hiroyuki
2010-12-16 13:50 ` Gerald Schaefer
2010-12-17 0:04 ` Minchan Kim
2010-12-17 5:47 ` Paul E. McKenney
2010-12-17 5:59 ` Eric Dumazet [this message]
2010-12-17 15:08 ` Minchan Kim
2010-12-17 16:03 ` Paul E. McKenney
2010-12-17 8:39 ` Mel Gorman
2010-12-17 9:28 ` Mel Gorman
2010-12-17 15:22 ` Minchan Kim
2010-12-17 15:13 ` Minchan Kim
2010-12-17 16:01 ` Paul E. McKenney
2010-11-23 7:16 ` [BUG?] [Ext4] INFO: suspicious rcu_dereference_check() usage KOSAKI Motohiro
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=1292565541.2655.28.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=ab@arunbhanu.com \
--cc=akpm@linux-foundation.org \
--cc=gerald.schaefer@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=miltonm@bga.com \
--cc=minchan.kim@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=schwidefsky@de.ibm.com \
--cc=tytso@mit.edu \
/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