diff options
author | Greg Pearson <greg.pearson@hp.com> | 2012-06-20 12:53:05 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-20 14:39:36 -0700 |
commit | 48c3b583bbddad2220ca4c22319ca5d1f78b2090 (patch) | |
tree | 6b9b4c3dfa6dcd4360a629c081958bd137284fad /include/asm-generic | |
parent | 5702c5eeab959e86ee2d9b4fe7f2d87e65b25d46 (diff) | |
download | op-kernel-dev-48c3b583bbddad2220ca4c22319ca5d1f78b2090.zip op-kernel-dev-48c3b583bbddad2220ca4c22319ca5d1f78b2090.tar.gz |
mm/memblock: fix overlapping allocation when doubling reserved array
__alloc_memory_core_early() asks memblock for a range of memory then try
to reserve it. If the reserved region array lacks space for the new
range, memblock_double_array() is called to allocate more space for the
array. If memblock is used to allocate memory for the new array it can
end up using a range that overlaps with the range originally allocated in
__alloc_memory_core_early(), leading to possible data corruption.
With this patch memblock_double_array() now calls memblock_find_in_range()
with a narrowed candidate range (in cases where the reserved.regions array
is being doubled) so any memory allocated will not overlap with the
original range that was being reserved. The range is narrowed by passing
in the starting address and size of the previously allocated range. Then
the range above the ending address is searched and if a candidate is not
found, the range below the starting address is searched.
Signed-off-by: Greg Pearson <greg.pearson@hp.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-generic')
0 files changed, 0 insertions, 0 deletions