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.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 979b42106979..9c769a47ac5a 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -4,6 +4,7 @@
4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
5 */ 5 */
6 6
7#include "vfs.h"
7#include "xdr.h" 8#include "xdr.h"
8#include "auth.h" 9#include "auth.h"
9 10
@@ -100,12 +101,14 @@ decode_sattr(__be32 *p, struct iattr *iap)
100 iap->ia_mode = tmp; 101 iap->ia_mode = tmp;
101 } 102 }
102 if ((tmp = ntohl(*p++)) != (u32)-1) { 103 if ((tmp = ntohl(*p++)) != (u32)-1) {
103 iap->ia_valid |= ATTR_UID; 104 iap->ia_uid = make_kuid(&init_user_ns, tmp);
104 iap->ia_uid = tmp; 105 if (uid_valid(iap->ia_uid))
106 iap->ia_valid |= ATTR_UID;
105 } 107 }
106 if ((tmp = ntohl(*p++)) != (u32)-1) { 108 if ((tmp = ntohl(*p++)) != (u32)-1) {
107 iap->ia_valid |= ATTR_GID; 109 iap->ia_gid = make_kgid(&init_user_ns, tmp);
108 iap->ia_gid = tmp; 110 if (gid_valid(iap->ia_gid))
111 iap->ia_valid |= ATTR_GID;
109 } 112 }
110 if ((tmp = ntohl(*p++)) != (u32)-1) { 113 if ((tmp = ntohl(*p++)) != (u32)-1) {
111 iap->ia_valid |= ATTR_SIZE; 114 iap->ia_valid |= ATTR_SIZE;
@@ -151,8 +154,8 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
151 *p++ = htonl(nfs_ftypes[type >> 12]); 154 *p++ = htonl(nfs_ftypes[type >> 12]);
152 *p++ = htonl((u32) stat->mode); 155 *p++ = htonl((u32) stat->mode);
153 *p++ = htonl((u32) stat->nlink); 156 *p++ = htonl((u32) stat->nlink);
154 *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid)); 157 *p++ = htonl((u32) from_kuid(&init_user_ns, stat->uid));
155 *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid)); 158 *p++ = htonl((u32) from_kgid(&init_user_ns, stat->gid));
156 159
157 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) { 160 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
158 *p++ = htonl(NFS_MAXPATHLEN); 161 *p++ = htonl(NFS_MAXPATHLEN);
@@ -194,11 +197,9 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
194} 197}
195 198
196/* Helper function for NFSv2 ACL code */ 199/* Helper function for NFSv2 ACL code */
197__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) 200__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat)
198{ 201{
199 struct kstat stat; 202 return encode_fattr(rqstp, p, fhp, stat);
200 vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, &stat);
201 return encode_fattr(rqstp, p, fhp, &stat);
202} 203}
203 204
204/* 205/*