* [PATCH] NFSD: Check acl returned from get_acl/posix_acl_from_mode
@ 2014-07-09 13:54 Kinglong Mee
2014-07-10 7:43 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Kinglong Mee @ 2014-07-09 13:54 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: Linux NFS Mailing List, kinglongmee
Commit 4ac7249ea5 (nfsd: use get_acl and ->set_acl)
don't check the acl returned from get_acl()/posix_acl_from_mode().
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
fs/nfsd/nfs2acl.c | 8 ++++----
fs/nfsd/nfs3acl.c | 8 ++++----
fs/nfsd/nfs4acl.c | 19 +++++++++++++------
3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index 12b023a..ac54ea6 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -54,14 +54,14 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
if (resp->mask & (NFS_ACL|NFS_ACLCNT)) {
acl = get_acl(inode, ACL_TYPE_ACCESS);
- if (IS_ERR(acl)) {
- nfserr = nfserrno(PTR_ERR(acl));
- goto fail;
- }
if (acl == NULL) {
/* Solaris returns the inode's minimum ACL. */
acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
}
+ if (IS_ERR(acl)) {
+ nfserr = nfserrno(PTR_ERR(acl));
+ goto fail;
+ }
resp->acl_access = acl;
}
if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) {
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index 2a514e2..34cbbab 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -47,14 +47,14 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,
if (resp->mask & (NFS_ACL|NFS_ACLCNT)) {
acl = get_acl(inode, ACL_TYPE_ACCESS);
- if (IS_ERR(acl)) {
- nfserr = nfserrno(PTR_ERR(acl));
- goto fail;
- }
if (acl == NULL) {
/* Solaris returns the inode's minimum ACL. */
acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
}
+ if (IS_ERR(acl)) {
+ nfserr = nfserrno(PTR_ERR(acl));
+ goto fail;
+ }
resp->acl_access = acl;
}
if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) {
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index acf6974..59fd766 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -146,17 +146,23 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry,
int size = 0;
pacl = get_acl(inode, ACL_TYPE_ACCESS);
- if (!pacl) {
+ if (!pacl)
pacl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
- if (IS_ERR(pacl))
- return PTR_ERR(pacl);
- }
+
+ if (IS_ERR(pacl))
+ return PTR_ERR(pacl);
+
/* allocate for worst case: one (deny, allow) pair each: */
size += 2 * pacl->a_count;
if (S_ISDIR(inode->i_mode)) {
flags = NFS4_ACL_DIR;
dpacl = get_acl(inode, ACL_TYPE_DEFAULT);
+ if (IS_ERR(dpacl)) {
+ error = PTR_ERR(dpacl);
+ goto rel_pacl;
+ }
+
if (dpacl)
size += 2 * dpacl->a_count;
}
@@ -173,9 +179,10 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry,
if (dpacl)
_posix_to_nfsv4_one(dpacl, *acl, flags | NFS4_ACL_TYPE_DEFAULT);
- out:
- posix_acl_release(pacl);
+out:
posix_acl_release(dpacl);
+rel_pacl:
+ posix_acl_release(pacl);
return error;
}
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] NFSD: Check acl returned from get_acl/posix_acl_from_mode
2014-07-09 13:54 [PATCH] NFSD: Check acl returned from get_acl/posix_acl_from_mode Kinglong Mee
@ 2014-07-10 7:43 ` Christoph Hellwig
2014-07-11 18:53 ` J. Bruce Fields
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2014-07-10 7:43 UTC (permalink / raw)
To: Kinglong Mee; +Cc: J. Bruce Fields, Linux NFS Mailing List
On Wed, Jul 09, 2014 at 09:54:16PM +0800, Kinglong Mee wrote:
> Commit 4ac7249ea5 (nfsd: use get_acl and ->set_acl)
> don't check the acl returned from get_acl()/posix_acl_from_mode().
>
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] NFSD: Check acl returned from get_acl/posix_acl_from_mode
2014-07-10 7:43 ` Christoph Hellwig
@ 2014-07-11 18:53 ` J. Bruce Fields
0 siblings, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2014-07-11 18:53 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Kinglong Mee, Linux NFS Mailing List
On Thu, Jul 10, 2014 at 12:43:24AM -0700, Christoph Hellwig wrote:
> On Wed, Jul 09, 2014 at 09:54:16PM +0800, Kinglong Mee wrote:
> > Commit 4ac7249ea5 (nfsd: use get_acl and ->set_acl)
> > don't check the acl returned from get_acl()/posix_acl_from_mode().
> >
> > Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
>
> Looks good,
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Thanks, applying for 3.17.
--b.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-11 18:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-09 13:54 [PATCH] NFSD: Check acl returned from get_acl/posix_acl_from_mode Kinglong Mee
2014-07-10 7:43 ` Christoph Hellwig
2014-07-11 18:53 ` J. Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox