diff options
| -rw-r--r-- | fs/nfsd/nfs4state.c | 3 | ||||
| -rw-r--r-- | fs/nfsd/vfs.c | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index aa309aa93fe8..4cf04e11c66c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp) | |||
| 258 | if (atomic_dec_and_test(&fp->fi_delegees)) { | 258 | if (atomic_dec_and_test(&fp->fi_delegees)) { |
| 259 | vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease); | 259 | vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease); |
| 260 | fp->fi_lease = NULL; | 260 | fp->fi_lease = NULL; |
| 261 | fput(fp->fi_deleg_file); | ||
| 261 | fp->fi_deleg_file = NULL; | 262 | fp->fi_deleg_file = NULL; |
| 262 | } | 263 | } |
| 263 | } | 264 | } |
| @@ -402,8 +403,8 @@ static void free_generic_stateid(struct nfs4_stateid *stp) | |||
| 402 | if (stp->st_access_bmap) { | 403 | if (stp->st_access_bmap) { |
| 403 | oflag = nfs4_access_bmap_to_omode(stp); | 404 | oflag = nfs4_access_bmap_to_omode(stp); |
| 404 | nfs4_file_put_access(stp->st_file, oflag); | 405 | nfs4_file_put_access(stp->st_file, oflag); |
| 405 | put_nfs4_file(stp->st_file); | ||
| 406 | } | 406 | } |
| 407 | put_nfs4_file(stp->st_file); | ||
| 407 | kmem_cache_free(stateid_slab, stp); | 408 | kmem_cache_free(stateid_slab, stp); |
| 408 | } | 409 | } |
| 409 | 410 | ||
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 2e1cebde90df..129f3c9f62d5 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
| @@ -1363,7 +1363,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1363 | goto out; | 1363 | goto out; |
| 1364 | if (!(iap->ia_valid & ATTR_MODE)) | 1364 | if (!(iap->ia_valid & ATTR_MODE)) |
| 1365 | iap->ia_mode = 0; | 1365 | iap->ia_mode = 0; |
| 1366 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); | 1366 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC); |
| 1367 | if (err) | 1367 | if (err) |
| 1368 | goto out; | 1368 | goto out; |
| 1369 | 1369 | ||
| @@ -1385,6 +1385,13 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1385 | if (IS_ERR(dchild)) | 1385 | if (IS_ERR(dchild)) |
| 1386 | goto out_nfserr; | 1386 | goto out_nfserr; |
| 1387 | 1387 | ||
| 1388 | /* If file doesn't exist, check for permissions to create one */ | ||
| 1389 | if (!dchild->d_inode) { | ||
| 1390 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); | ||
| 1391 | if (err) | ||
| 1392 | goto out; | ||
| 1393 | } | ||
| 1394 | |||
| 1388 | err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); | 1395 | err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); |
| 1389 | if (err) | 1396 | if (err) |
| 1390 | goto out; | 1397 | goto out; |
