diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-05 15:10:44 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-11 06:44:59 -0500 |
commit | e77414e0aad6a1b063ba5e5750c582c75327ea6a (patch) | |
tree | 9492b584ce6a3e4f99570ce4517d7efaaff4fb93 | |
parent | bb52d6694002b9d632bb355f64daa045c6293a4e (diff) |
fix broken aliasing checks for MAP_FIXED on sparc32, mips, arm and sh
We want addr - (pgoff << PAGE_SHIFT) consistently coloured...
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | arch/arm/mm/mmap.c | 3 | ||||
-rw-r--r-- | arch/mips/kernel/syscall.c | 3 | ||||
-rw-r--r-- | arch/sh/mm/mmap.c | 3 | ||||
-rw-r--r-- | arch/sparc/kernel/sys_sparc_32.c | 3 |
4 files changed, 8 insertions, 4 deletions
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index 2b7996401b0f..f5abc51c5a07 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c | |||
@@ -54,7 +54,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
54 | * We enforce the MAP_FIXED case. | 54 | * We enforce the MAP_FIXED case. |
55 | */ | 55 | */ |
56 | if (flags & MAP_FIXED) { | 56 | if (flags & MAP_FIXED) { |
57 | if (aliasing && flags & MAP_SHARED && addr & (SHMLBA - 1)) | 57 | if (aliasing && flags & MAP_SHARED && |
58 | (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)) | ||
58 | return -EINVAL; | 59 | return -EINVAL; |
59 | return addr; | 60 | return addr; |
60 | } | 61 | } |
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index c25b2e7dcb7b..3f7f466190b4 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -93,7 +93,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
93 | * We do not accept a shared mapping if it would violate | 93 | * We do not accept a shared mapping if it would violate |
94 | * cache aliasing constraints. | 94 | * cache aliasing constraints. |
95 | */ | 95 | */ |
96 | if ((flags & MAP_SHARED) && (addr & shm_align_mask)) | 96 | if ((flags & MAP_SHARED) && |
97 | ((addr - (pgoff << PAGE_SHIFT)) & shm_align_mask)) | ||
97 | return -EINVAL; | 98 | return -EINVAL; |
98 | return addr; | 99 | return addr; |
99 | } | 100 | } |
diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c index d2984fa42d3d..afeb710ec5c3 100644 --- a/arch/sh/mm/mmap.c +++ b/arch/sh/mm/mmap.c | |||
@@ -54,7 +54,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
54 | /* We do not accept a shared mapping if it would violate | 54 | /* We do not accept a shared mapping if it would violate |
55 | * cache aliasing constraints. | 55 | * cache aliasing constraints. |
56 | */ | 56 | */ |
57 | if ((flags & MAP_SHARED) && (addr & shm_align_mask)) | 57 | if ((flags & MAP_SHARED) && |
58 | ((addr - (pgoff << PAGE_SHIFT)) & shm_align_mask)) | ||
58 | return -EINVAL; | 59 | return -EINVAL; |
59 | return addr; | 60 | return addr; |
60 | } | 61 | } |
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c index 997bdd0d3d70..3a82e65d8db2 100644 --- a/arch/sparc/kernel/sys_sparc_32.c +++ b/arch/sparc/kernel/sys_sparc_32.c | |||
@@ -45,7 +45,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi | |||
45 | /* We do not accept a shared mapping if it would violate | 45 | /* We do not accept a shared mapping if it would violate |
46 | * cache aliasing constraints. | 46 | * cache aliasing constraints. |
47 | */ | 47 | */ |
48 | if ((flags & MAP_SHARED) && (addr & (SHMLBA - 1))) | 48 | if ((flags & MAP_SHARED) && |
49 | ((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1))) | ||
49 | return -EINVAL; | 50 | return -EINVAL; |
50 | return addr; | 51 | return addr; |
51 | } | 52 | } |