aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2013-02-01 17:26:23 -0500
committerEric W. Biederman <ebiederm@xmission.com>2013-02-13 09:15:33 -0500
commit9ff593c4739c76c31ffdf7f2a1d67489ece728e6 (patch)
treecec4de986fba9139c02dc94e81b871ffeb87de0b /fs/nfs
parente5782076e72be2a39bf261f7db03e1769ec05198 (diff)
nfs: kuid and kgid conversions for nfs/inode.c
- Use uid_eq and gid_eq when comparing kuids and kgids. - Use make_kuid(&init_user_ns, -2) and make_kgid(&init_user_ns, -2) as the initial uid and gid on nfs inodes, instead of using the typeunsafe value of -2. Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/inode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index ebeb94ce1b0b..ce2b0394c4d6 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -332,8 +332,8 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
332 inode->i_version = 0; 332 inode->i_version = 0;
333 inode->i_size = 0; 333 inode->i_size = 0;
334 clear_nlink(inode); 334 clear_nlink(inode);
335 inode->i_uid = -2; 335 inode->i_uid = make_kuid(&init_user_ns, -2);
336 inode->i_gid = -2; 336 inode->i_gid = make_kgid(&init_user_ns, -2);
337 inode->i_blocks = 0; 337 inode->i_blocks = 0;
338 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); 338 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
339 nfsi->write_io = 0; 339 nfsi->write_io = 0;
@@ -1009,9 +1009,9 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
1009 /* Have any file permissions changed? */ 1009 /* Have any file permissions changed? */
1010 if ((fattr->valid & NFS_ATTR_FATTR_MODE) && (inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO)) 1010 if ((fattr->valid & NFS_ATTR_FATTR_MODE) && (inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO))
1011 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL; 1011 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
1012 if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && inode->i_uid != fattr->uid) 1012 if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && !uid_eq(inode->i_uid, fattr->uid))
1013 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL; 1013 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
1014 if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && inode->i_gid != fattr->gid) 1014 if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && !gid_eq(inode->i_gid, fattr->gid))
1015 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL; 1015 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
1016 1016
1017 /* Has the link count changed? */ 1017 /* Has the link count changed? */
@@ -1440,7 +1440,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1440 | NFS_INO_REVAL_FORCED); 1440 | NFS_INO_REVAL_FORCED);
1441 1441
1442 if (fattr->valid & NFS_ATTR_FATTR_OWNER) { 1442 if (fattr->valid & NFS_ATTR_FATTR_OWNER) {
1443 if (inode->i_uid != fattr->uid) { 1443 if (!uid_eq(inode->i_uid, fattr->uid)) {
1444 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; 1444 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
1445 inode->i_uid = fattr->uid; 1445 inode->i_uid = fattr->uid;
1446 } 1446 }
@@ -1451,7 +1451,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1451 | NFS_INO_REVAL_FORCED); 1451 | NFS_INO_REVAL_FORCED);
1452 1452
1453 if (fattr->valid & NFS_ATTR_FATTR_GROUP) { 1453 if (fattr->valid & NFS_ATTR_FATTR_GROUP) {
1454 if (inode->i_gid != fattr->gid) { 1454 if (!gid_eq(inode->i_gid, fattr->gid)) {
1455 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; 1455 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
1456 inode->i_gid = fattr->gid; 1456 inode->i_gid = fattr->gid;
1457 } 1457 }