aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsxdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfsxdr.c')
-rw-r--r--fs/nfsd/nfsxdr.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 1e51e7034a89..4201ede0ec91 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -100,12 +100,14 @@ decode_sattr(__be32 *p, struct iattr *iap)
100 iap->ia_mode = tmp; 100 iap->ia_mode = tmp;
101 } 101 }
102 if ((tmp = ntohl(*p++)) != (u32)-1) { 102 if ((tmp = ntohl(*p++)) != (u32)-1) {
103 iap->ia_valid |= ATTR_UID; 103 iap->ia_uid = make_kuid(&init_user_ns, tmp);
104 iap->ia_uid = tmp; 104 if (uid_valid(iap->ia_uid))
105 iap->ia_valid |= ATTR_UID;
105 } 106 }
106 if ((tmp = ntohl(*p++)) != (u32)-1) { 107 if ((tmp = ntohl(*p++)) != (u32)-1) {
107 iap->ia_valid |= ATTR_GID; 108 iap->ia_gid = make_kgid(&init_user_ns, tmp);
108 iap->ia_gid = tmp; 109 if (gid_valid(iap->ia_gid))
110 iap->ia_valid |= ATTR_GID;
109 } 111 }
110 if ((tmp = ntohl(*p++)) != (u32)-1) { 112 if ((tmp = ntohl(*p++)) != (u32)-1) {
111 iap->ia_valid |= ATTR_SIZE; 113 iap->ia_valid |= ATTR_SIZE;
@@ -151,8 +153,8 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
151 *p++ = htonl(nfs_ftypes[type >> 12]); 153 *p++ = htonl(nfs_ftypes[type >> 12]);
152 *p++ = htonl((u32) stat->mode); 154 *p++ = htonl((u32) stat->mode);
153 *p++ = htonl((u32) stat->nlink); 155 *p++ = htonl((u32) stat->nlink);
154 *p++ = htonl((u32) stat->uid); 156 *p++ = htonl((u32) from_kuid(&init_user_ns, stat->uid));
155 *p++ = htonl((u32) stat->gid); 157 *p++ = htonl((u32) from_kgid(&init_user_ns, stat->gid));
156 158
157 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) { 159 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
158 *p++ = htonl(NFS_MAXPATHLEN); 160 *p++ = htonl(NFS_MAXPATHLEN);