diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-08-08 01:44:15 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-08-10 07:04:42 -0400 |
commit | d1f5a77f2c9db5b8a565eabdf8b534b02e32cc44 (patch) | |
tree | 536fd6176fa632cf67a08c85683b58406d9697dc | |
parent | 8f2ea1fd3f97ab7a809e939b5b9005a16f862439 (diff) |
[POWERPC] Fix size check for hugetlbfs
My "slices" address space management code that was added in the 2.6.22
implementation of get_unmapped_area() doesn't properly check that the
size is a multiple of the requested page size. This allows userland to
create VMAs that aren't a multiple of the huge page size with hugetlbfs
(since hugetlbfs entirely relies on get_unmapped_area() to do that
checking) which leads to a kernel BUG() when such areas are torn down.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/mm/slice.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index f833dba2a028..d5fd3909d13a 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/slice.c | |||
@@ -405,6 +405,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, | |||
405 | 405 | ||
406 | if (len > mm->task_size) | 406 | if (len > mm->task_size) |
407 | return -ENOMEM; | 407 | return -ENOMEM; |
408 | if (len & ((1ul << pshift) - 1)) | ||
409 | return -EINVAL; | ||
408 | if (fixed && (addr & ((1ul << pshift) - 1))) | 410 | if (fixed && (addr & ((1ul << pshift) - 1))) |
409 | return -EINVAL; | 411 | return -EINVAL; |
410 | if (fixed && addr > (mm->task_size - len)) | 412 | if (fixed && addr > (mm->task_size - len)) |