mm: fix wrong vmap address calculations with odd NR_CPUS values
Commit db64fe02258f ("mm: rewrite vmap layer") introduced code that does
address calculations under the assumption that VMAP_BLOCK_SIZE is a
power of two. However, this might not be true if CONFIG_NR_CPUS is not
set to a power of two.
Wrong vmap_block index/offset values could lead to memory corruption.
However, this has never been observed in practice (or never been
diagnosed correctly); what caught this was the BUG_ON in vb_alloc() that
checks for inconsistent vmap_block indices.
To fix this, ensure that VMAP_BLOCK_SIZE always is a power of two.
Reported-by: Pavel Kysilka <email@example.com>
Reported-by: Matias A. Fonzo <firstname.lastname@example.org>
Signed-off-by: Clemens Ladisch <email@example.com>
Signed-off-by: Stefan Richter <firstname.lastname@example.org>
Cc: Nick Piggin <email@example.com>
Cc: Jeremy Fitzhardinge <firstname.lastname@example.org>
Cc: Krzysztof Helt <email@example.com>
Cc: Andrew Morton <firstname.lastname@example.org>
Cc: 2.6.28+ <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
1 file changed