David Gibson dec4ad86c2 hugepage: fix broken check for offset alignment in hugepage mappings
For hugepage mappings, the file offset, like the address and size, needs to
be aligned to the size of a hugepage.

In commit 68589bc353037f233fe510ad9ff432338c95db66, the check for this was
moved into prepare_hugepage_range() along with the address and size checks.
 But since BenH's rework of the get_unmapped_area() paths leading up to
commit 4b1d89290b62bb2db476c94c82cf7442aab440c8, prepare_hugepage_range()
is only called for MAP_FIXED mappings, not for other mappings.  This means
we're no longer ever checking for an aligned offset - I've confirmed that
mmap() will (apparently) succeed with a misaligned offset on both powerpc
and i386 at least.

This patch restores the check, removing it from prepare_hugepage_range()
and putting it back into hugetlbfs_file_mmap().  I'm putting it there,
rather than in the get_unmapped_area() path so it only needs to go in one
place, than separately in the half-dozen or so arch-specific
implementations of hugetlb_get_unmapped_area().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Cc: Adam Litke <agl@us.ibm.com>
Cc: Andi Kleen <ak@suse.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-31 01:42:23 -07:00
..
2007-07-31 15:39:40 -07:00
2007-08-22 19:52:46 -07:00
2007-05-08 11:14:59 -07:00
2007-08-20 22:44:27 -07:00
2007-07-16 09:05:52 -07:00
2007-07-31 15:39:36 -07:00
2007-07-26 11:11:57 -07:00
2007-07-21 17:49:14 -07:00
2006-10-04 06:51:26 -06:00
2007-07-20 08:44:19 -07:00
2007-07-19 10:04:43 -07:00
2007-07-19 10:04:45 -07:00
2007-07-29 17:09:29 -07:00
2007-05-18 13:09:34 -07:00
2007-05-21 09:18:19 -07:00
2007-05-08 11:15:01 -07:00
2007-05-08 11:15:09 -07:00
2007-07-16 09:05:48 -07:00
2007-05-09 06:44:57 +02:00
2007-07-31 15:39:43 -07:00
2007-05-11 08:29:36 -07:00
2007-07-19 10:04:45 -07:00
2007-07-19 10:04:45 -07:00
2007-07-27 08:08:51 +02:00
2006-10-01 00:39:19 -07:00
2007-07-27 15:40:13 -07:00
2007-07-10 08:04:15 +02:00
2007-05-09 07:10:02 +02:00
2007-07-27 08:08:51 +02:00
2007-07-16 09:05:46 -07:00