switch prctl_set_mm_exe_file() to fget_light()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 27 Aug 2012 17:02:21 +0000 (13:02 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 27 Sep 2012 01:10:12 +0000 (21:10 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
kernel/sys.c

index 241507f23eca097871bec58f5976476f352f3d75..0cb4283df884e0bf32927f497f96642141ee81e7 100644 (file)
@@ -1790,9 +1790,9 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd)
 {
        struct file *exe_file;
        struct dentry *dentry;
-       int err;
+       int err, fput_needed;
 
-       exe_file = fget(fd);
+       exe_file = fget_light(fd, &fput_needed);
        if (!exe_file)
                return -EBADF;
 
@@ -1839,12 +1839,12 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd)
                goto exit_unlock;
 
        err = 0;
-       set_mm_exe_file(mm, exe_file);
+       set_mm_exe_file(mm, exe_file);  /* this grabs a reference to exe_file */
 exit_unlock:
        up_write(&mm->mmap_sem);
 
 exit:
-       fput(exe_file);
+       fput_light(exe_file, fput_needed);
        return err;
 }