aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsacl.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-11-25 08:00:35 -0500
committerSteve French <smfrench@gmail.com>2012-12-05 14:12:16 -0500
commitc78cd83805d43198e1ef452fba27fa049db6387f (patch)
treebb01a3f9ce785d51805e2a66e12141ebe653f481 /fs/cifs/cifsacl.c
parent60654ce047f7be62afa291573501e011297a47d8 (diff)
cifs: clean up id_mode_to_cifs_acl
Add a label we can goto on error, and get rid of some excess indentation. Also move to kernel-style comments. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r--fs/cifs/cifsacl.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 0fb15bbbe43c..b45ec7426ae3 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -1307,42 +1307,39 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
1307 1307
1308 /* Get the security descriptor */ 1308 /* Get the security descriptor */
1309 pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen); 1309 pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen);
1310
1311 /* Add three ACEs for owner, group, everyone getting rid of
1312 other ACEs as chmod disables ACEs and set the security descriptor */
1313
1314 if (IS_ERR(pntsd)) { 1310 if (IS_ERR(pntsd)) {
1315 rc = PTR_ERR(pntsd); 1311 rc = PTR_ERR(pntsd);
1316 cERROR(1, "%s: error %d getting sec desc", __func__, rc); 1312 cERROR(1, "%s: error %d getting sec desc", __func__, rc);
1317 } else { 1313 goto out;
1318 /* allocate memory for the smb header, 1314 }
1319 set security descriptor request security descriptor
1320 parameters, and secuirty descriptor itself */
1321
1322 secdesclen = secdesclen < DEFSECDESCLEN ?
1323 DEFSECDESCLEN : secdesclen;
1324 pnntsd = kmalloc(secdesclen, GFP_KERNEL);
1325 if (!pnntsd) {
1326 cERROR(1, "Unable to allocate security descriptor");
1327 kfree(pntsd);
1328 return -ENOMEM;
1329 }
1330 1315
1331 rc = build_sec_desc(pntsd, pnntsd, secdesclen, nmode, uid, gid, 1316 /*
1332 &aclflag); 1317 * Add three ACEs for owner, group, everyone getting rid of other ACEs
1318 * as chmod disables ACEs and set the security descriptor. Allocate
1319 * memory for the smb header, set security descriptor request security
1320 * descriptor parameters, and secuirty descriptor itself
1321 */
1322 secdesclen = max_t(u32, secdesclen, DEFSECDESCLEN);
1323 pnntsd = kmalloc(secdesclen, GFP_KERNEL);
1324 if (!pnntsd) {
1325 cERROR(1, "Unable to allocate security descriptor");
1326 kfree(pntsd);
1327 return -ENOMEM;
1328 }
1333 1329
1334 cFYI(DBG2, "build_sec_desc rc: %d", rc); 1330 rc = build_sec_desc(pntsd, pnntsd, secdesclen, nmode, uid, gid,
1331 &aclflag);
1335 1332
1336 if (!rc) { 1333 cFYI(DBG2, "build_sec_desc rc: %d", rc);
1337 /* Set the security descriptor */
1338 rc = set_cifs_acl(pnntsd, secdesclen, inode,
1339 path, aclflag);
1340 cFYI(DBG2, "set_cifs_acl rc: %d", rc);
1341 }
1342 1334
1343 kfree(pnntsd); 1335 if (!rc) {
1344 kfree(pntsd); 1336 /* Set the security descriptor */
1337 rc = set_cifs_acl(pnntsd, secdesclen, inode, path, aclflag);
1338 cFYI(DBG2, "set_cifs_acl rc: %d", rc);
1345 } 1339 }
1346 1340
1341 kfree(pnntsd);
1342 kfree(pntsd);
1343out:
1347 return rc; 1344 return rc;
1348} 1345}