From: Al Viro Date: Fri, 30 Aug 2013 16:48:53 +0000 (-0400) Subject: switch fchmod() to fdget X-Git-Tag: firefly_0821_release~176^2~5429^2~5 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=173c84012a594a9ee18b63673ab760482c37ad78;p=firefly-linux-kernel-4.4.55.git switch fchmod() to fdget Signed-off-by: Al Viro --- diff --git a/fs/open.c b/fs/open.c index 7931f76acc2b..8070825b285b 100644 --- a/fs/open.c +++ b/fs/open.c @@ -485,14 +485,13 @@ out_unlock: SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode) { - struct file * file; + struct fd f = fdget(fd); int err = -EBADF; - file = fget(fd); - if (file) { - audit_inode(NULL, file->f_path.dentry, 0); - err = chmod_common(&file->f_path, mode); - fput(file); + if (f.file) { + audit_inode(NULL, f.file->f_path.dentry, 0); + err = chmod_common(&f.file->f_path, mode); + fdput(f); } return err; }