aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/sys_sparc.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-09-13 17:07:18 -0400
committerPaul Mackerras <paulus@samba.org>2006-09-13 17:07:18 -0400
commitc547fc28ab3e8716076fdaf4bd0260c5d63a18f7 (patch)
tree34af1fa64a63618660187ae58ad182665a1861ef /arch/sparc64/kernel/sys_sparc.c
parent3dd836a56de0d4f049438412959b905e1db4666e (diff)
parent63b98080daa35f0d682db04f4fb7ada010888752 (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'arch/sparc64/kernel/sys_sparc.c')
-rw-r--r--arch/sparc64/kernel/sys_sparc.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 054d0abdb7ee..bf5f14ee73de 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -548,6 +548,26 @@ asmlinkage long sparc64_personality(unsigned long personality)
548 return ret; 548 return ret;
549} 549}
550 550
551int sparc64_mmap_check(unsigned long addr, unsigned long len,
552 unsigned long flags)
553{
554 if (test_thread_flag(TIF_32BIT)) {
555 if (len >= STACK_TOP32)
556 return -EINVAL;
557
558 if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len)
559 return -EINVAL;
560 } else {
561 if (len >= VA_EXCLUDE_START)
562 return -EINVAL;
563
564 if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len))
565 return -EINVAL;
566 }
567
568 return 0;
569}
570
551/* Linux version of mmap */ 571/* Linux version of mmap */
552asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 572asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
553 unsigned long prot, unsigned long flags, unsigned long fd, 573 unsigned long prot, unsigned long flags, unsigned long fd,
@@ -563,27 +583,11 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
563 } 583 }
564 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); 584 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
565 len = PAGE_ALIGN(len); 585 len = PAGE_ALIGN(len);
566 retval = -EINVAL;
567
568 if (test_thread_flag(TIF_32BIT)) {
569 if (len >= STACK_TOP32)
570 goto out_putf;
571
572 if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len)
573 goto out_putf;
574 } else {
575 if (len >= VA_EXCLUDE_START)
576 goto out_putf;
577
578 if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len))
579 goto out_putf;
580 }
581 586
582 down_write(&current->mm->mmap_sem); 587 down_write(&current->mm->mmap_sem);
583 retval = do_mmap(file, addr, len, prot, flags, off); 588 retval = do_mmap(file, addr, len, prot, flags, off);
584 up_write(&current->mm->mmap_sem); 589 up_write(&current->mm->mmap_sem);
585 590
586out_putf:
587 if (file) 591 if (file)
588 fput(file); 592 fput(file);
589out: 593out: