Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: add a vfs_fchown helper

Add a helper for struct file based chown 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>

+19 -12
+17 -12
fs/open.c
··· 740 740 AT_SYMLINK_NOFOLLOW); 741 741 } 742 742 743 + int vfs_fchown(struct file *file, uid_t user, gid_t group) 744 + { 745 + int error; 746 + 747 + error = mnt_want_write_file(file); 748 + if (error) 749 + return error; 750 + audit_file(file); 751 + error = chown_common(&file->f_path, user, group); 752 + mnt_drop_write_file(file); 753 + return error; 754 + } 755 + 743 756 int ksys_fchown(unsigned int fd, uid_t user, gid_t group) 744 757 { 745 758 struct fd f = fdget(fd); 746 759 int error = -EBADF; 747 760 748 - if (!f.file) 749 - goto out; 750 - 751 - error = mnt_want_write_file(f.file); 752 - if (error) 753 - goto out_fput; 754 - audit_file(f.file); 755 - error = chown_common(&f.file->f_path, user, group); 756 - mnt_drop_write_file(f.file); 757 - out_fput: 758 - fdput(f); 759 - out: 761 + if (f.file) { 762 + error = vfs_fchown(f.file, user, group); 763 + fdput(f); 764 + } 760 765 return error; 761 766 } 762 767
+2
include/linux/fs.h
··· 1744 1744 int (*f)(struct dentry *, umode_t, void *), 1745 1745 void *); 1746 1746 1747 + int vfs_fchown(struct file *file, uid_t user, gid_t group); 1748 + 1747 1749 extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 1748 1750 1749 1751 #ifdef CONFIG_COMPAT