Clemens Ladisch f982f91516 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.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=31572
Reported-by: Pavel Kysilka <goldenfish@linuxsoft.cz>
Reported-by: Matias A. Fonzo <selk@dragora.org>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: 2.6.28+ <stable@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-14 12:32:52 -07:00
..
2009-04-01 08:59:13 -07:00
2011-07-25 20:57:14 -07:00
2011-05-26 09:20:31 -07:00
2011-07-25 20:57:09 -07:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2011-07-26 16:49:47 -07:00
2011-07-20 20:47:46 -04:00
2009-09-22 07:17:35 -07:00
2011-05-26 09:20:31 -07:00
2010-03-24 16:31:21 -07:00
2011-01-13 17:32:46 -08:00
2011-05-25 08:39:18 -07:00
2010-05-21 18:31:21 -04:00
2011-03-10 08:52:27 +01:00
2011-07-25 20:57:09 -07:00
2011-05-20 12:50:29 -07:00
2011-07-26 16:49:47 -07:00
2011-07-25 20:57:07 -07:00
2011-03-10 08:52:07 +01:00
2011-05-25 08:39:05 -07:00
2011-07-26 16:49:42 -07:00