]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/exec.c
exec: increase BINPRM_BUF_SIZE to 256
[linux.git] / fs / exec.c
index fb72d36f7823e912716ba5ad97f5b120575bf30b..2e0033348d8e10c02a5c3928caec876798edb1fd 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -932,7 +932,7 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size,
                bytes = kernel_read(file, *buf + pos, i_size - pos, &pos);
                if (bytes < 0) {
                        ret = bytes;
-                       goto out;
+                       goto out_free;
                }
 
                if (bytes == 0)
@@ -1189,7 +1189,7 @@ static int de_thread(struct task_struct *tsk)
        flush_itimer_signals();
 #endif
 
-       if (atomic_read(&oldsighand->count) != 1) {
+       if (refcount_read(&oldsighand->count) != 1) {
                struct sighand_struct *newsighand;
                /*
                 * This ->sighand is shared with the CLONE_SIGHAND
@@ -1199,7 +1199,7 @@ static int de_thread(struct task_struct *tsk)
                if (!newsighand)
                        return -ENOMEM;
 
-               atomic_set(&newsighand->count, 1);
+               refcount_set(&newsighand->count, 1);
                memcpy(newsighand->action, oldsighand->action,
                       sizeof(newsighand->action));
 
@@ -1563,7 +1563,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
 
 /*
  * Fill the binprm structure from the inode.
- * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
+ * Check permissions, then read the first BINPRM_BUF_SIZE bytes
  *
  * This may be called multiple times for binary chains (scripts for example).
  */
@@ -1944,15 +1944,10 @@ EXPORT_SYMBOL(set_binfmt);
  */
 void set_dumpable(struct mm_struct *mm, int value)
 {
-       unsigned long old, new;
-
        if (WARN_ON((unsigned)value > SUID_DUMP_ROOT))
                return;
 
-       do {
-               old = READ_ONCE(mm->flags);
-               new = (old & ~MMF_DUMPABLE_MASK) | value;
-       } while (cmpxchg(&mm->flags, old, new) != old);
+       set_mask_bits(&mm->flags, MMF_DUMPABLE_MASK, value);
 }
 
 SYSCALL_DEFINE3(execve,