summaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-14 08:55:05 +0200
committerChristoph Hellwig <hch@lst.de>2020-07-16 15:33:04 +0200
commit9e96c8c0e94eea2f69a9705f5d0f51928ea26c17 (patch)
treeb37bff2ea4afb198636d736ad4e4572af4aeaeb3 /fs/open.c
parentfs: add a vfs_fchown helper (diff)
downloadlinux-9e96c8c0e94eea2f69a9705f5d0f51928ea26c17.tar.xz
linux-9e96c8c0e94eea2f69a9705f5d0f51928ea26c17.zip
fs: add a vfs_fchmod helper
Add a helper for struct file based chmode operations. To be used by the initramfs code soon. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/open.c b/fs/open.c
index 103c66309bee..75166f071d28 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -602,14 +602,19 @@ out_unlock:
return error;
}
+int vfs_fchmod(struct file *file, umode_t mode)
+{
+ audit_file(file);
+ return chmod_common(&file->f_path, mode);
+}
+
int ksys_fchmod(unsigned int fd, umode_t mode)
{
struct fd f = fdget(fd);
int err = -EBADF;
if (f.file) {
- audit_file(f.file);
- err = chmod_common(&f.file->f_path, mode);
+ err = vfs_fchmod(f.file, mode);
fdput(f);
}
return err;