On Tue, Aug 28, 2012 at 5:10 PM, Linus Torvalds wrote: > On Tue, Aug 28, 2012 at 10:05 AM, Linus Torvalds > wrote: >> >> Ugh. Ok, looking closer at this, > > Btw, looking at that code, I also found what looks like a potential > locking bug in allocate_resource(). > > The code does > > if (new->parent) > .. reallocate .. > > to check whether a resource was already allocated. HOWEVER, it does so > without actually holding the resource lock. Which means that > "new->parent" might in theory change. > > I don't really know if we care. Anybody who does a > "allocate_resource()" on an existing resource that might already be in > the resource tree hopefully does *not* do that in parallel with > another user trying to change the resource allocation, so maybe the > right thing to do is to just say "whatever, if there is a race with > two threads reallocating the same resource at the same time, the bug > is a much more serious one at a higher level". yes, another patch that that split __allocate_resource out have the similar fix. http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=commitdiff;h=5d52b21303b7271ba4c5302b387766628f074ae2 but the changelog does not that mention the reason. also have another version for probe_resource, please check attached version -v8. Thanks Yinghai