switch fchmod(2) to fget_light()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 27 Aug 2012 00:22:10 +0000 (20:22 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 27 Sep 2012 01:10:03 +0000 (21:10 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/open.c

index da6d3f1ac243d8f93f114224876b36fcbc310557..3c741eae6b991889756a31f75461e619eeef0c2c 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -582,23 +582,21 @@ SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group
 
 SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
 {
-       struct file * file;
-       int error = -EBADF;
-       struct dentry * dentry;
+       struct file *file;
+       int error = -EBADF, fput_needed;
 
-       file = fget(fd);
+       file = fget_light(fd, &fput_needed);
        if (!file)
                goto out;
 
        error = mnt_want_write_file(file);
        if (error)
                goto out_fput;
-       dentry = file->f_path.dentry;
-       audit_inode(NULL, dentry);
+       audit_inode(NULL, file->f_path.dentry);
        error = chown_common(&file->f_path, user, group);
        mnt_drop_write_file(file);
 out_fput:
-       fput(file);
+       fput_light(file, fput_needed);
 out:
        return error;
 }