mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 23:47:06 +00:00
mm: bootmem: fix checking the bitmap when finally freeing bootmem
When bootmem releases an unaligned chunk of memory at the beginning of a
node to the page allocator, it iterates from that unaligned PFN but
checks an aligned word of the page bitmap. The checked bits do not
correspond to the PFNs and, as a result, reserved pages can be freed.
Properly shift the bitmap word so that the lowest bit corresponds to the
starting PFN before entering the freeing loop.
This bug has been around since commit 41546c1741 ("bootmem: clean up
free_all_bootmem_core") (2.6.27) without known reports.
Signed-off-by: Gavin Shan <[email protected]>
Signed-off-by: Johannes Weiner <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Acked-by: David S. Miller <[email protected]>
Cc: Yinghai Lu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
committed by
Linus Torvalds
parent
955c1cd740
commit
6dccdcbe2c
@@ -203,6 +203,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
|
||||
} else {
|
||||
unsigned long off = 0;
|
||||
|
||||
vec >>= start & (BITS_PER_LONG - 1);
|
||||
while (vec && off < BITS_PER_LONG) {
|
||||
if (vec & 1) {
|
||||
page = pfn_to_page(start + off);
|
||||
|
||||
Reference in New Issue
Block a user