Revert "Merge remote-tracking branch 'linux-2.6.32.y/master' into develop"
[firefly-linux-kernel-4.4.55.git] / fs / exec.c
index 86fafc6bd75d2d32714757d933bcc556748acec4..68083fab2c9f8422f8be9b793e67b5b824893126 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -159,22 +159,7 @@ out:
 
 #ifdef CONFIG_MMU
 
-void acct_arg_size(struct linux_binprm *bprm, unsigned long pages)
-{
-       struct mm_struct *mm = current->mm;
-       long diff = (long)(pages - bprm->vma_pages);
-
-       if (!mm || !diff)
-               return;
-
-       bprm->vma_pages = pages;
-
-       down_write(&mm->mmap_sem);
-       mm->total_vm += diff;
-       up_write(&mm->mmap_sem);
-}
-
-struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
+static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
                int write)
 {
        struct page *page;
@@ -196,8 +181,6 @@ struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
                unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start;
                struct rlimit *rlim;
 
-               acct_arg_size(bprm, size / PAGE_SIZE);
-
                /*
                 * We've historically supported up to 32 pages (ARG_MAX)
                 * of argument strings even with small stacks
@@ -291,11 +274,7 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len)
 
 #else
 
-void acct_arg_size(struct linux_binprm *bprm, unsigned long pages)
-{
-}
-
-struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
+static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
                int write)
 {
        struct page *page;
@@ -1002,14 +981,12 @@ int flush_old_exec(struct linux_binprm * bprm)
        /*
         * Release all of the old mmap stuff
         */
-       acct_arg_size(bprm, 0);
        retval = exec_mmap(bprm->mm);
        if (retval)
                goto out;
 
        bprm->mm = NULL;                /* We're using it now */
 
-       set_fs(USER_DS);
        current->flags &= ~PF_RANDOMIZE;
        flush_thread();
        current->personality &= ~bprm->per_clear;
@@ -1277,6 +1254,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
        if (retval)
                return retval;
 
+       /* kernel module loader fixup */
+       /* so we don't try to load run modprobe in kernel space. */
+       set_fs(USER_DS);
+
        retval = audit_bprm(bprm);
        if (retval)
                return retval;
@@ -1427,10 +1408,8 @@ int do_execve(char * filename,
        return retval;
 
 out:
-       if (bprm->mm) {
-               acct_arg_size(bprm, 0);
-               mmput(bprm->mm);
-       }
+       if (bprm->mm)
+               mmput (bprm->mm);
 
 out_file:
        if (bprm->file) {