summaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 8072a09fd0b9..ba2bafa22885 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2194,3 +2194,26 @@ int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags,
2194 return 0; 2194 return 0;
2195} 2195}
2196EXPORT_SYMBOL(vfs_ioc_setflags_prepare); 2196EXPORT_SYMBOL(vfs_ioc_setflags_prepare);
2197
2198/*
2199 * Generic function to check FS_IOC_FSSETXATTR values and reject any invalid
2200 * configurations.
2201 *
2202 * Note: the caller should be holding i_mutex, or else be sure that they have
2203 * exclusive access to the inode structure.
2204 */
2205int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa,
2206 struct fsxattr *fa)
2207{
2208 /*
2209 * Can't modify an immutable/append-only file unless we have
2210 * appropriate permission.
2211 */
2212 if ((old_fa->fsx_xflags ^ fa->fsx_xflags) &
2213 (FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND) &&
2214 !capable(CAP_LINUX_IMMUTABLE))
2215 return -EPERM;
2216
2217 return 0;
2218}
2219EXPORT_SYMBOL(vfs_ioc_fssetxattr_check);