aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/compat_linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/compat_linux.c')
-rw-r--r--arch/s390/kernel/compat_linux.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index fda1a8123f9b..22c9e557bb22 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -31,14 +31,8 @@
31#include <linux/shm.h> 31#include <linux/shm.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/uio.h> 33#include <linux/uio.h>
34#include <linux/nfs_fs.h>
35#include <linux/quota.h> 34#include <linux/quota.h>
36#include <linux/module.h> 35#include <linux/module.h>
37#include <linux/sunrpc/svc.h>
38#include <linux/nfsd/nfsd.h>
39#include <linux/nfsd/cache.h>
40#include <linux/nfsd/xdr.h>
41#include <linux/nfsd/syscall.h>
42#include <linux/poll.h> 36#include <linux/poll.h>
43#include <linux/personality.h> 37#include <linux/personality.h>
44#include <linux/stat.h> 38#include <linux/stat.h>
@@ -630,38 +624,6 @@ struct mmap_arg_struct_emu31 {
630 u32 offset; 624 u32 offset;
631}; 625};
632 626
633/* common code for old and new mmaps */
634static inline long do_mmap2(
635 unsigned long addr, unsigned long len,
636 unsigned long prot, unsigned long flags,
637 unsigned long fd, unsigned long pgoff)
638{
639 struct file * file = NULL;
640 unsigned long error = -EBADF;
641
642 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
643 if (!(flags & MAP_ANONYMOUS)) {
644 file = fget(fd);
645 if (!file)
646 goto out;
647 }
648
649 down_write(&current->mm->mmap_sem);
650 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
651 if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) {
652 /* Result is out of bounds. */
653 do_munmap(current->mm, addr, len);
654 error = -ENOMEM;
655 }
656 up_write(&current->mm->mmap_sem);
657
658 if (file)
659 fput(file);
660out:
661 return error;
662}
663
664
665asmlinkage unsigned long 627asmlinkage unsigned long
666old32_mmap(struct mmap_arg_struct_emu31 __user *arg) 628old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
667{ 629{
@@ -675,7 +637,8 @@ old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
675 if (a.offset & ~PAGE_MASK) 637 if (a.offset & ~PAGE_MASK)
676 goto out; 638 goto out;
677 639
678 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);
679out: 642out:
680 return error; 643 return error;
681} 644}
@@ -688,7 +651,7 @@ sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
688 651
689 if (copy_from_user(&a, arg, sizeof(a))) 652 if (copy_from_user(&a, arg, sizeof(a)))
690 goto out; 653 goto out;
691 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);
692out: 655out:
693 return error; 656 return error;
694} 657}