diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-14 18:03:40 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-14 18:03:40 -0700 |
commit | c825e992acf06e5eab8a6cb5254f3316d3053028 (patch) | |
tree | 5fa17fba4cc0ec2cf0960f4ec38683e6d8b4d0e5 | |
parent | 9c1765acd28a968d0f390ec64de4d9b967691005 (diff) | |
download | stable-queue-c825e992acf06e5eab8a6cb5254f3316d3053028.tar.gz |
3.0 patches
-rw-r--r-- | queue-3.0/mm-fix-wrong-vmap-address-calculations-with-odd-nr_cpus.patch | 53 | ||||
-rw-r--r-- | queue-3.0/series | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/queue-3.0/mm-fix-wrong-vmap-address-calculations-with-odd-nr_cpus.patch b/queue-3.0/mm-fix-wrong-vmap-address-calculations-with-odd-nr_cpus.patch new file mode 100644 index 0000000000..e2ed7a1a27 --- /dev/null +++ b/queue-3.0/mm-fix-wrong-vmap-address-calculations-with-odd-nr_cpus.patch @@ -0,0 +1,53 @@ +From f982f91516fa4cfd9d20518833cd04ad714585be Mon Sep 17 00:00:00 2001 +From: Clemens Ladisch <clemens@ladisch.de> +Date: Tue, 21 Jun 2011 22:09:50 +0200 +Subject: mm: fix wrong vmap address calculations with odd NR_CPUS values + +From: Clemens Ladisch <clemens@ladisch.de> + +commit f982f91516fa4cfd9d20518833cd04ad714585be upstream. + +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> +Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + mm/vmalloc.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/mm/vmalloc.c ++++ b/mm/vmalloc.c +@@ -732,9 +732,10 @@ static void free_unmap_vmap_area_addr(un + #define VMAP_BBMAP_BITS_MIN (VMAP_MAX_ALLOC*2) + #define VMAP_MIN(x, y) ((x) < (y) ? (x) : (y)) /* can't use min() */ + #define VMAP_MAX(x, y) ((x) > (y) ? (x) : (y)) /* can't use max() */ +-#define VMAP_BBMAP_BITS VMAP_MIN(VMAP_BBMAP_BITS_MAX, \ +- VMAP_MAX(VMAP_BBMAP_BITS_MIN, \ +- VMALLOC_PAGES / NR_CPUS / 16)) ++#define VMAP_BBMAP_BITS \ ++ VMAP_MIN(VMAP_BBMAP_BITS_MAX, \ ++ VMAP_MAX(VMAP_BBMAP_BITS_MIN, \ ++ VMALLOC_PAGES / roundup_pow_of_two(NR_CPUS) / 16)) + + #define VMAP_BLOCK_SIZE (VMAP_BBMAP_BITS * PAGE_SIZE) + diff --git a/queue-3.0/series b/queue-3.0/series index 211e57219b..b30e974554 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -18,3 +18,4 @@ asoc-fix-binding-of-wm8750-on-jive.patch asoc-tegra-tegra_pcm_deallocate_dma_buffer-don-t-oops.patch asoc-tegra-wm8903-machine-driver-allow-re-insertion-of.patch ath5k-fix-error-handling-in-ath5k_beacon_send.patch +mm-fix-wrong-vmap-address-calculations-with-odd-nr_cpus.patch |