aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ.Bruce Fields <bfields@fieldses.org>2006-10-04 05:16:14 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 10:55:20 -0400
commitb66285cee3f9abad26cca6c9b848e1ad6b792d94 (patch)
tree504c36192cd4c255b7082b7b68a526a5fe118527 /fs/nfsd
parentf3b64eb6efb1ef46f6629b66a429e7f2b5955003 (diff)
[PATCH] knfsd: nfsd4: acls: fix handling of zero-length acls
It is legal to have zero-length NFSv4 acls; they just deny everything. Also, nfs4_acl_nfsv4_to_posix will always return with pacl and dpacl set on success, so the caller doesn't need to check this. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4acl.c15
-rw-r--r--fs/nfsd/vfs.c10
2 files changed, 5 insertions, 20 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index 105544eac9a3..5d94555cdc83 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -357,33 +357,20 @@ nfs4_acl_nfsv4_to_posix(struct nfs4_acl *acl, struct posix_acl **pacl,
357 goto out; 357 goto out;
358 358
359 error = nfs4_acl_split(acl, dacl); 359 error = nfs4_acl_split(acl, dacl);
360 if (error < 0) 360 if (error)
361 goto out_acl; 361 goto out_acl;
362 362
363 if (acl->naces == 0) {
364 error = -ENODATA;
365 goto try_dpacl;
366 }
367
368 *pacl = _nfsv4_to_posix_one(acl, flags); 363 *pacl = _nfsv4_to_posix_one(acl, flags);
369 if (IS_ERR(*pacl)) { 364 if (IS_ERR(*pacl)) {
370 error = PTR_ERR(*pacl); 365 error = PTR_ERR(*pacl);
371 *pacl = NULL; 366 *pacl = NULL;
372 goto out_acl; 367 goto out_acl;
373 } 368 }
374try_dpacl:
375 if (dacl->naces == 0) {
376 if (pacl == NULL || *pacl == NULL)
377 error = -ENODATA;
378 goto out_acl;
379 }
380 369
381 error = 0;
382 *dpacl = _nfsv4_to_posix_one(dacl, flags); 370 *dpacl = _nfsv4_to_posix_one(dacl, flags);
383 if (IS_ERR(*dpacl)) { 371 if (IS_ERR(*dpacl)) {
384 error = PTR_ERR(*dpacl); 372 error = PTR_ERR(*dpacl);
385 *dpacl = NULL; 373 *dpacl = NULL;
386 goto out_acl;
387 } 374 }
388out_acl: 375out_acl:
389 if (error) { 376 if (error) {
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 137565a136d7..1141bd29e4e3 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -447,13 +447,11 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
447 } else if (error < 0) 447 } else if (error < 0)
448 goto out_nfserr; 448 goto out_nfserr;
449 449
450 if (pacl) { 450 error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS);
451 error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS); 451 if (error < 0)
452 if (error < 0) 452 goto out_nfserr;
453 goto out_nfserr;
454 }
455 453
456 if (dpacl) { 454 if (S_ISDIR(inode->i_mode)) {
457 error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT); 455 error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT);
458 if (error < 0) 456 if (error < 0)
459 goto out_nfserr; 457 goto out_nfserr;