summaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorToshinobu Sugioka <sugioka@itonet.co.jp>2009-04-21 07:34:53 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-04-21 07:34:53 +0900
commit8c31813f31cd4403b46802866949a95a6e8fa584 (patch)
tree83f774f5b0f979d53b909638efe56d8dc2e05ea0 /arch/sh
parentaefe6475720bd5eb8aacbc881488f3aa65618562 (diff)
downloadop-kernel-dev-8c31813f31cd4403b46802866949a95a6e8fa584.zip
op-kernel-dev-8c31813f31cd4403b46802866949a95a6e8fa584.tar.gz
sh: Fix mmap2 for handling differing PAGE_SIZEs.
mmap2 uses a fixed page shift of 12, regardless of the PAGE_SIZE setting. Fix up the mmap2 code to add some sanity checks on the mapping, and to update pgoff accordingly. Error handling bits based on 4280e3126f641898f0ed1a931645373d3489e2a6 ("frv: fix mmap2 error handling"). Signed-off-by: Toshinobu Sugioka <sugioka@itonet.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/sys_sh.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 58dfc02..e3a7e36 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -63,6 +63,15 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)
{
+ /*
+ * The shift for mmap2 is constant, regardless of PAGE_SIZE
+ * setting.
+ */
+ if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1))
+ return -EINVAL;
+
+ pgoff >>= PAGE_SHIFT - 12;
+
return do_mmap2(addr, len, prot, flags, fd, pgoff);
}
OpenPOWER on IntegriCloud