diff options
Diffstat (limited to 'arch/s390/kernel/compat_linux.c')
| -rw-r--r-- | arch/s390/kernel/compat_linux.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 25c31d681402..22c9e557bb22 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
| @@ -624,38 +624,6 @@ struct mmap_arg_struct_emu31 { | |||
| 624 | u32 offset; | 624 | u32 offset; |
| 625 | }; | 625 | }; |
| 626 | 626 | ||
| 627 | /* common code for old and new mmaps */ | ||
| 628 | static inline long do_mmap2( | ||
| 629 | unsigned long addr, unsigned long len, | ||
| 630 | unsigned long prot, unsigned long flags, | ||
| 631 | unsigned long fd, unsigned long pgoff) | ||
| 632 | { | ||
| 633 | struct file * file = NULL; | ||
| 634 | unsigned long error = -EBADF; | ||
| 635 | |||
| 636 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
| 637 | if (!(flags & MAP_ANONYMOUS)) { | ||
| 638 | file = fget(fd); | ||
| 639 | if (!file) | ||
| 640 | goto out; | ||
| 641 | } | ||
| 642 | |||
| 643 | down_write(¤t->mm->mmap_sem); | ||
| 644 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
| 645 | if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) { | ||
| 646 | /* Result is out of bounds. */ | ||
| 647 | do_munmap(current->mm, addr, len); | ||
| 648 | error = -ENOMEM; | ||
| 649 | } | ||
| 650 | up_write(¤t->mm->mmap_sem); | ||
| 651 | |||
| 652 | if (file) | ||
| 653 | fput(file); | ||
| 654 | out: | ||
| 655 | return error; | ||
| 656 | } | ||
| 657 | |||
| 658 | |||
| 659 | asmlinkage unsigned long | 627 | asmlinkage unsigned long |
| 660 | old32_mmap(struct mmap_arg_struct_emu31 __user *arg) | 628 | old32_mmap(struct mmap_arg_struct_emu31 __user *arg) |
| 661 | { | 629 | { |
| @@ -669,7 +637,8 @@ old32_mmap(struct mmap_arg_struct_emu31 __user *arg) | |||
| 669 | if (a.offset & ~PAGE_MASK) | 637 | if (a.offset & ~PAGE_MASK) |
| 670 | goto out; | 638 | goto out; |
| 671 | 639 | ||
| 672 | error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); | 640 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, |
| 641 | a.offset >> PAGE_SHIFT); | ||
| 673 | out: | 642 | out: |
| 674 | return error; | 643 | return error; |
| 675 | } | 644 | } |
| @@ -682,7 +651,7 @@ sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) | |||
| 682 | 651 | ||
| 683 | if (copy_from_user(&a, arg, sizeof(a))) | 652 | if (copy_from_user(&a, arg, sizeof(a))) |
| 684 | goto out; | 653 | goto out; |
| 685 | error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); | 654 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); |
| 686 | out: | 655 | out: |
| 687 | return error; | 656 | return error; |
| 688 | } | 657 | } |
