aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-05-07 05:24:28 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-07 05:24:28 -0400
commit5816339310b2d9623cf413d33e538b45e815da5d (patch)
tree268187469afc7e9eae439ef613f0c9f86f5e91ba /arch
parentd45100f7b69e3d9cd0cd5e956b6ac2c78d460d07 (diff)
sparc: Fix mmap VA span checking.
We should not conditionalize VA range checks on MAP_FIXED. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/kernel/sys_sparc.c3
-rw-r--r--arch/sparc64/kernel/sys_sparc.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index f188b5dc9fd0..e995491c4436 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -223,8 +223,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
223{ 223{
224 if (ARCH_SUN4C_SUN4 && 224 if (ARCH_SUN4C_SUN4 &&
225 (len > 0x20000000 || 225 (len > 0x20000000 ||
226 ((flags & MAP_FIXED) && 226 (addr < 0xe0000000 && addr + len > 0x20000000)))
227 addr < 0xe0000000 && addr + len > 0x20000000)))
228 return -EINVAL; 227 return -EINVAL;
229 228
230 /* See asm-sparc/uaccess.h */ 229 /* See asm-sparc/uaccess.h */
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 8d4761f15fa9..0dbc941f130e 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -549,13 +549,13 @@ int sparc64_mmap_check(unsigned long addr, unsigned long len,
549 if (len >= STACK_TOP32) 549 if (len >= STACK_TOP32)
550 return -EINVAL; 550 return -EINVAL;
551 551
552 if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len) 552 if (addr > STACK_TOP32 - len)
553 return -EINVAL; 553 return -EINVAL;
554 } else { 554 } else {
555 if (len >= VA_EXCLUDE_START) 555 if (len >= VA_EXCLUDE_START)
556 return -EINVAL; 556 return -EINVAL;
557 557
558 if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len)) 558 if (invalid_64bit_range(addr, len))
559 return -EINVAL; 559 return -EINVAL;
560 } 560 }
561 561