]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc: Fix size check for hugetlbfs
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 8 Aug 2007 05:44:15 +0000 (15:44 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 15 Aug 2007 16:25:09 +0000 (09:25 -0700)
My "slices" address space management code that was added in 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/powerpc/mm/slice.c

index f833dba2a0287ea06218f180620b8634300a58e7..d5fd3909d13a2cb45c01b2c56d236b67ea39b9a5 100644 (file)
@@ -405,6 +405,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
 
        if (len > mm->task_size)
                return -ENOMEM;
+       if (len & ((1ul << pshift) - 1))
+               return -EINVAL;
        if (fixed && (addr & ((1ul << pshift) - 1)))
                return -EINVAL;
        if (fixed && addr > (mm->task_size - len))