Commit b66285ce authored by J.Bruce Fields's avatar J.Bruce Fields Committed by Linus Torvalds

[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: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f3b64eb6
...@@ -357,33 +357,20 @@ nfs4_acl_nfsv4_to_posix(struct nfs4_acl *acl, struct posix_acl **pacl, ...@@ -357,33 +357,20 @@ nfs4_acl_nfsv4_to_posix(struct nfs4_acl *acl, struct posix_acl **pacl,
goto out; goto out;
error = nfs4_acl_split(acl, dacl); error = nfs4_acl_split(acl, dacl);
if (error < 0) if (error)
goto out_acl; goto out_acl;
if (acl->naces == 0) {
error = -ENODATA;
goto try_dpacl;
}
*pacl = _nfsv4_to_posix_one(acl, flags); *pacl = _nfsv4_to_posix_one(acl, flags);
if (IS_ERR(*pacl)) { if (IS_ERR(*pacl)) {
error = PTR_ERR(*pacl); error = PTR_ERR(*pacl);
*pacl = NULL; *pacl = NULL;
goto out_acl; goto out_acl;
} }
try_dpacl:
if (dacl->naces == 0) {
if (pacl == NULL || *pacl == NULL)
error = -ENODATA;
goto out_acl;
}
error = 0;
*dpacl = _nfsv4_to_posix_one(dacl, flags); *dpacl = _nfsv4_to_posix_one(dacl, flags);
if (IS_ERR(*dpacl)) { if (IS_ERR(*dpacl)) {
error = PTR_ERR(*dpacl); error = PTR_ERR(*dpacl);
*dpacl = NULL; *dpacl = NULL;
goto out_acl;
} }
out_acl: out_acl:
if (error) { if (error) {
......
...@@ -447,13 +447,11 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -447,13 +447,11 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
} else if (error < 0) } else if (error < 0)
goto out_nfserr; goto out_nfserr;
if (pacl) {
error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS); error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS);
if (error < 0) if (error < 0)
goto out_nfserr; goto out_nfserr;
}
if (dpacl) { if (S_ISDIR(inode->i_mode)) {
error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT); error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT);
if (error < 0) if (error < 0)
goto out_nfserr; goto out_nfserr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment