VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Eric W. Biederman <ebiederm@xmission.com> 2016-06-29 14:54:46 -0500 committer: Eric W. Biederman <ebiederm@xmission.com> 2016-07-05 15:06:46 -0500 commit: 0bd23d09b874e53bd1a2fe2296030aa2720d7b08 parent: 5f65e5ca286126a60f62c8421b77c2018a482b8a
Commit Summary:
vfs: Don't modify inodes with a uid or gid unknown to the vfs
Diffstat:
1 file changed, 7 insertions, 0 deletions
diff --git a/fs/xattr.c b/fs/xattr.c
index 4beafc43daa5..c243905835ab 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -38,6 +38,13 @@ xattr_permission(struct inode *inode, const char *name, int mask)
 	if (mask & MAY_WRITE) {
 		if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
 			return -EPERM;
+		/*
+		 * Updating an xattr will likely cause i_uid and i_gid
+		 * to be writen back improperly if their true value is
+		 * unknown to the vfs.
+		 */
+		if (HAS_UNMAPPED_ID(inode))
+			return -EPERM;
 	}
 
 	/*