Skip to content

Commit 5171317

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: update new ACE pointer after populate_new_aces.
After the fix for retaining externally set ACEs with cifsacl and modefromsid,idsfromsid, there was an issue in populating the inherited ACEs after setting the ACEs introduced by these two modes. Fixed this by updating the ACE pointer again after the call to populate_new_aces. Signed-off-by: Shyam Prasad N <[email protected]> Reviewed-by: Rohith Surabattula <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 1e28eed commit 5171317

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

fs/cifs/cifsacl.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,6 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl,
11181118
/* Retain old ACEs which we can retain */
11191119
for (i = 0; i < src_num_aces; ++i) {
11201120
pntace = (struct cifs_ace *) (acl_base + size);
1121-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
11221121

11231122
if (!new_aces_set && (pntace->flags & INHERITED_ACE)) {
11241123
/* Place the new ACEs in between existing explicit and inherited */
@@ -1131,14 +1130,18 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl,
11311130
}
11321131

11331132
/* If it's any one of the ACE we're replacing, skip! */
1134-
if ((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) ||
1133+
if (!mode_from_sid &&
1134+
((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) ||
11351135
(compare_sids(&pntace->sid, pownersid) == 0) ||
11361136
(compare_sids(&pntace->sid, pgrpsid) == 0) ||
11371137
(compare_sids(&pntace->sid, &sid_everyone) == 0) ||
1138-
(compare_sids(&pntace->sid, &sid_authusers) == 0)) {
1138+
(compare_sids(&pntace->sid, &sid_authusers) == 0))) {
11391139
goto next_ace;
11401140
}
11411141

1142+
/* update the pointer to the next ACE to populate*/
1143+
pnntace = (struct cifs_ace *) (nacl_base + nsize);
1144+
11421145
nsize += cifs_copy_ace(pnntace, pntace, NULL);
11431146
num_aces++;
11441147

0 commit comments

Comments
 (0)