diff options
author | Kinglong Mee <kinglongmee@gmail.com> | 2014-07-09 09:54:16 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-07-11 15:03:53 -0400 |
commit | 35e634b83cbe23e5673289d1536752968aab8f75 (patch) | |
tree | 77660dfe5a38520090ac78c8a1f1a967dd42771c /fs/nfsd/nfs4acl.c | |
parent | 255942907e7ff498ab1545b5edce5690833ff640 (diff) |
NFSD: Check acl returned from get_acl/posix_acl_from_mode
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4acl.c')
-rw-r--r-- | fs/nfsd/nfs4acl.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index acf6974e6823..59fd76651781 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, | |||
146 | int size = 0; | 146 | int size = 0; |
147 | 147 | ||
148 | pacl = get_acl(inode, ACL_TYPE_ACCESS); | 148 | pacl = get_acl(inode, ACL_TYPE_ACCESS); |
149 | if (!pacl) { | 149 | if (!pacl) |
150 | pacl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL); | 150 | pacl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL); |
151 | if (IS_ERR(pacl)) | 151 | |
152 | return PTR_ERR(pacl); | 152 | if (IS_ERR(pacl)) |
153 | } | 153 | return PTR_ERR(pacl); |
154 | |||
154 | /* allocate for worst case: one (deny, allow) pair each: */ | 155 | /* allocate for worst case: one (deny, allow) pair each: */ |
155 | size += 2 * pacl->a_count; | 156 | size += 2 * pacl->a_count; |
156 | 157 | ||
157 | if (S_ISDIR(inode->i_mode)) { | 158 | if (S_ISDIR(inode->i_mode)) { |
158 | flags = NFS4_ACL_DIR; | 159 | flags = NFS4_ACL_DIR; |
159 | dpacl = get_acl(inode, ACL_TYPE_DEFAULT); | 160 | dpacl = get_acl(inode, ACL_TYPE_DEFAULT); |
161 | if (IS_ERR(dpacl)) { | ||
162 | error = PTR_ERR(dpacl); | ||
163 | goto rel_pacl; | ||
164 | } | ||
165 | |||
160 | if (dpacl) | 166 | if (dpacl) |
161 | size += 2 * dpacl->a_count; | 167 | size += 2 * dpacl->a_count; |
162 | } | 168 | } |
@@ -173,9 +179,10 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, | |||
173 | if (dpacl) | 179 | if (dpacl) |
174 | _posix_to_nfsv4_one(dpacl, *acl, flags | NFS4_ACL_TYPE_DEFAULT); | 180 | _posix_to_nfsv4_one(dpacl, *acl, flags | NFS4_ACL_TYPE_DEFAULT); |
175 | 181 | ||
176 | out: | 182 | out: |
177 | posix_acl_release(pacl); | ||
178 | posix_acl_release(dpacl); | 183 | posix_acl_release(dpacl); |
184 | rel_pacl: | ||
185 | posix_acl_release(pacl); | ||
179 | return error; | 186 | return error; |
180 | } | 187 | } |
181 | 188 | ||