diff options
Diffstat (limited to 'arch/sparc64/kernel/sys_sparc.c')
-rw-r--r-- | arch/sparc64/kernel/sys_sparc.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 0dbc941f130e..ac1bff58c1ac 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c | |||
@@ -542,8 +542,7 @@ asmlinkage long sparc64_personality(unsigned long personality) | |||
542 | return ret; | 542 | return ret; |
543 | } | 543 | } |
544 | 544 | ||
545 | int sparc64_mmap_check(unsigned long addr, unsigned long len, | 545 | int sparc64_mmap_check(unsigned long addr, unsigned long len) |
546 | unsigned long flags) | ||
547 | { | 546 | { |
548 | if (test_thread_flag(TIF_32BIT)) { | 547 | if (test_thread_flag(TIF_32BIT)) { |
549 | if (len >= STACK_TOP32) | 548 | if (len >= STACK_TOP32) |
@@ -609,46 +608,19 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr, | |||
609 | unsigned long old_len, unsigned long new_len, | 608 | unsigned long old_len, unsigned long new_len, |
610 | unsigned long flags, unsigned long new_addr) | 609 | unsigned long flags, unsigned long new_addr) |
611 | { | 610 | { |
612 | struct vm_area_struct *vma; | ||
613 | unsigned long ret = -EINVAL; | 611 | unsigned long ret = -EINVAL; |
614 | 612 | ||
615 | if (test_thread_flag(TIF_32BIT)) | 613 | if (test_thread_flag(TIF_32BIT)) |
616 | goto out; | 614 | goto out; |
617 | if (unlikely(new_len >= VA_EXCLUDE_START)) | 615 | if (unlikely(new_len >= VA_EXCLUDE_START)) |
618 | goto out; | 616 | goto out; |
619 | if (unlikely(invalid_64bit_range(addr, old_len))) | 617 | if (unlikely(sparc64_mmap_check(addr, old_len))) |
618 | goto out; | ||
619 | if (unlikely(sparc64_mmap_check(new_addr, new_len))) | ||
620 | goto out; | 620 | goto out; |
621 | 621 | ||
622 | down_write(¤t->mm->mmap_sem); | 622 | down_write(¤t->mm->mmap_sem); |
623 | if (flags & MREMAP_FIXED) { | ||
624 | if (invalid_64bit_range(new_addr, new_len)) | ||
625 | goto out_sem; | ||
626 | } else if (invalid_64bit_range(addr, new_len)) { | ||
627 | unsigned long map_flags = 0; | ||
628 | struct file *file = NULL; | ||
629 | |||
630 | ret = -ENOMEM; | ||
631 | if (!(flags & MREMAP_MAYMOVE)) | ||
632 | goto out_sem; | ||
633 | |||
634 | vma = find_vma(current->mm, addr); | ||
635 | if (vma) { | ||
636 | if (vma->vm_flags & VM_SHARED) | ||
637 | map_flags |= MAP_SHARED; | ||
638 | file = vma->vm_file; | ||
639 | } | ||
640 | |||
641 | /* MREMAP_FIXED checked above. */ | ||
642 | new_addr = get_unmapped_area(file, addr, new_len, | ||
643 | vma ? vma->vm_pgoff : 0, | ||
644 | map_flags); | ||
645 | ret = new_addr; | ||
646 | if (new_addr & ~PAGE_MASK) | ||
647 | goto out_sem; | ||
648 | flags |= MREMAP_FIXED; | ||
649 | } | ||
650 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | 623 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); |
651 | out_sem: | ||
652 | up_write(¤t->mm->mmap_sem); | 624 | up_write(¤t->mm->mmap_sem); |
653 | out: | 625 | out: |
654 | return ret; | 626 | return ret; |