Commit 58163393 authored by David S. Miller's avatar David S. Miller

sparc: Fix mmap VA span checking.

We should not conditionalize VA range checks on MAP_FIXED.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d45100f7
...@@ -223,8 +223,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) ...@@ -223,8 +223,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
{ {
if (ARCH_SUN4C_SUN4 && if (ARCH_SUN4C_SUN4 &&
(len > 0x20000000 || (len > 0x20000000 ||
((flags & MAP_FIXED) && (addr < 0xe0000000 && addr + len > 0x20000000)))
addr < 0xe0000000 && addr + len > 0x20000000)))
return -EINVAL; return -EINVAL;
/* See asm-sparc/uaccess.h */ /* See asm-sparc/uaccess.h */
......
...@@ -549,13 +549,13 @@ int sparc64_mmap_check(unsigned long addr, unsigned long len, ...@@ -549,13 +549,13 @@ int sparc64_mmap_check(unsigned long addr, unsigned long len,
if (len >= STACK_TOP32) if (len >= STACK_TOP32)
return -EINVAL; return -EINVAL;
if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len) if (addr > STACK_TOP32 - len)
return -EINVAL; return -EINVAL;
} else { } else {
if (len >= VA_EXCLUDE_START) if (len >= VA_EXCLUDE_START)
return -EINVAL; return -EINVAL;
if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len)) if (invalid_64bit_range(addr, len))
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment