]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'akpm' (Andrew's patch-bomb)
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Dec 2012 04:00:43 +0000 (20:00 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Dec 2012 04:00:43 +0000 (20:00 -0800)
Merge the rest of Andrew's patches for -rc1:
 "A bunch of fixes and misc missed-out-on things.

  That'll do for -rc1.  I still have a batch of IPC patches which still
  have a possible bug report which I'm chasing down."

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (25 commits)
  keys: use keyring_alloc() to create module signing keyring
  keys: fix unreachable code
  sendfile: allows bypassing of notifier events
  SGI-XP: handle non-fatal traps
  fat: fix incorrect function comment
  Documentation: ABI: remove testing/sysfs-devices-node
  proc: fix inconsistent lock state
  linux/kernel.h: fix DIV_ROUND_CLOSEST with unsigned divisors
  memcg: don't register hotcpu notifier from ->css_alloc()
  checkpatch: warn on uapi #includes that #include <uapi/...
  revert "rtc: recycle id when unloading a rtc driver"
  mm: clean up transparent hugepage sysfs error messages
  hfsplus: add error message for the case of failure of sync fs in delayed_sync_fs() method
  hfsplus: rework processing of hfs_btree_write() returned error
  hfsplus: rework processing errors in hfsplus_free_extents()
  hfsplus: avoid crash on failed block map free
  kcmp: include linux/ptrace.h
  drivers/rtc/rtc-imxdi.c: must include <linux/spinlock.h>
  mm: cma: WARN if freed memory is still in use
  exec: do not leave bprm->interp on stack
  ...

1  2 
fs/exec.c
fs/proc/generic.c
include/linux/binfmts.h

diff --combined fs/exec.c
index af8ec80f816d3789d1f889e6017d73144a64ee9e,237d5342786c43499bf32cfb831607ff8c86a728..18c45cac368fe3ec830c7f0c8433e5cd2db0fc2d
+++ b/fs/exec.c
@@@ -1175,9 -1175,24 +1175,24 @@@ void free_bprm(struct linux_binprm *bpr
                mutex_unlock(&current->signal->cred_guard_mutex);
                abort_creds(bprm->cred);
        }
+       /* If a binfmt changed the interp, free it. */
+       if (bprm->interp != bprm->filename)
+               kfree(bprm->interp);
        kfree(bprm);
  }
  
+ int bprm_change_interp(char *interp, struct linux_binprm *bprm)
+ {
+       /* If a binfmt changed the interp, free it first. */
+       if (bprm->interp != bprm->filename)
+               kfree(bprm->interp);
+       bprm->interp = kstrdup(interp, GFP_KERNEL);
+       if (!bprm->interp)
+               return -ENOMEM;
+       return 0;
+ }
+ EXPORT_SYMBOL(bprm_change_interp);
  /*
   * install the new credentials for this executable
   */
@@@ -1654,6 -1669,7 +1669,6 @@@ int get_dumpable(struct mm_struct *mm
        return __get_dumpable(mm->flags);
  }
  
 -#ifdef __ARCH_WANT_SYS_EXECVE
  SYSCALL_DEFINE3(execve,
                const char __user *, filename,
                const char __user *const __user *, argv,
@@@ -1681,3 -1697,23 +1696,3 @@@ asmlinkage long compat_sys_execve(cons
        return error;
  }
  #endif
 -#endif
 -
 -#ifdef __ARCH_WANT_KERNEL_EXECVE
 -int kernel_execve(const char *filename,
 -                const char *const argv[],
 -                const char *const envp[])
 -{
 -      int ret = do_execve(filename,
 -                      (const char __user *const __user *)argv,
 -                      (const char __user *const __user *)envp);
 -      if (ret < 0)
 -              return ret;
 -
 -      /*
 -       * We were successful.  We won't be returning to our caller, but
 -       * instead to user space by manipulating the kernel stack.
 -       */
 -      ret_from_kernel_execve(current_pt_regs());
 -}
 -#endif
diff --combined fs/proc/generic.c
index 2e4ed13b9eedeeb53e3718d153c45227688a518f,e659a0ff1da72f9c18793aaf0a1a09be4d286cdf..e064f562b1f75daf2225d02ad031cd88a560cd95
@@@ -261,9 -261,16 +261,9 @@@ static int proc_notify_change(struct de
        if (error)
                return error;
  
 -      if ((iattr->ia_valid & ATTR_SIZE) &&
 -          iattr->ia_size != i_size_read(inode)) {
 -              error = vmtruncate(inode, iattr->ia_size);
 -              if (error)
 -                      return error;
 -      }
 -
        setattr_copy(inode, iattr);
        mark_inode_dirty(inode);
 -      
 +
        de->uid = inode->i_uid;
        de->gid = inode->i_gid;
        de->mode = inode->i_mode;
@@@ -352,18 -359,18 +352,18 @@@ retry
        if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL))
                return -ENOMEM;
  
-       spin_lock(&proc_inum_lock);
+       spin_lock_bh(&proc_inum_lock);
        error = ida_get_new(&proc_inum_ida, &i);
-       spin_unlock(&proc_inum_lock);
+       spin_unlock_bh(&proc_inum_lock);
        if (error == -EAGAIN)
                goto retry;
        else if (error)
                return error;
  
        if (i > UINT_MAX - PROC_DYNAMIC_FIRST) {
-               spin_lock(&proc_inum_lock);
+               spin_lock_bh(&proc_inum_lock);
                ida_remove(&proc_inum_ida, i);
-               spin_unlock(&proc_inum_lock);
+               spin_unlock_bh(&proc_inum_lock);
                return -ENOSPC;
        }
        *inum = PROC_DYNAMIC_FIRST + i;
  
  void proc_free_inum(unsigned int inum)
  {
-       spin_lock(&proc_inum_lock);
+       spin_lock_bh(&proc_inum_lock);
        ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
-       spin_unlock(&proc_inum_lock);
+       spin_unlock_bh(&proc_inum_lock);
  }
  
  static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
diff --combined include/linux/binfmts.h
index cf3eae0b4f5903bde23ce5f899e15226ef9898f0,bdf3965f0a29a9d6b3cf9568ce58dc457de32526..0530b9860359afb26cfb8a2a05ed7ec0a4c2169a
@@@ -112,6 -112,7 +112,7 @@@ extern int setup_arg_pages(struct linux
                           unsigned long stack_top,
                           int executable_stack);
  extern int bprm_mm_init(struct linux_binprm *bprm);
+ extern int bprm_change_interp(char *interp, struct linux_binprm *bprm);
  extern int copy_strings_kernel(int argc, const char *const *argv,
                               struct linux_binprm *bprm);
  extern int prepare_bprm_creds(struct linux_binprm *bprm);
@@@ -119,4 -120,8 +120,4 @@@ extern void install_exec_creds(struct l
  extern void set_binfmt(struct linux_binfmt *new);
  extern void free_bprm(struct linux_binprm *);
  
 -#ifdef __ARCH_WANT_KERNEL_EXECVE
 -extern void ret_from_kernel_execve(struct pt_regs *normal) __noreturn;
 -#endif
 -
  #endif /* _LINUX_BINFMTS_H */