aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2014-08-09 09:44:00 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-08-17 12:00:14 -0400
commit63bab0651be0ba857200219a08644e6a99f448b6 (patch)
tree17fd443e8c826a601742d107e81d90e5b1be5940 /fs/nfsd
parentafbda402a02bde74f350ff98243265dfd3108fb3 (diff)
nfsd3: Check write permission after checking existence
When creating a file that already exists in a read-only directory with O_EXCL, the NFSv3 server returns EACCES rather than EEXIST (which local files and the NFSv4 server return). Fix this by checking the MAY_CREATE permission only if the file does not exist. Since this already happens in do_nfsd_create, the check in nfsd3_proc_create can simply be removed. Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs3proc.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index fa2525b2e9d7..fc51f7f6b36d 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -223,11 +223,6 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
223 newfhp = fh_init(&resp->fh, NFS3_FHSIZE); 223 newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
224 attr = &argp->attrs; 224 attr = &argp->attrs;
225 225
226 /* Get the directory inode */
227 nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_CREATE);
228 if (nfserr)
229 RETURN_STATUS(nfserr);
230
231 /* Unfudge the mode bits */ 226 /* Unfudge the mode bits */
232 attr->ia_mode &= ~S_IFMT; 227 attr->ia_mode &= ~S_IFMT;
233 if (!(attr->ia_valid & ATTR_MODE)) { 228 if (!(attr->ia_valid & ATTR_MODE)) {