summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/open.c9
-rw-r--r--include/linux/fs.h1
2 files changed, 8 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;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0ddd64ca0b45..635086726f20 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1745,6 +1745,7 @@ int vfs_mkobj(struct dentry *, umode_t,
void *);
int vfs_fchown(struct file *file, uid_t user, gid_t group);
+int vfs_fchmod(struct file *file, umode_t mode);
extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);