|
@@ -542,7 +542,10 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags)
|
|
* up setting a 3-element effective posix ACL with all
|
|
* up setting a 3-element effective posix ACL with all
|
|
* permissions zero.
|
|
* permissions zero.
|
|
*/
|
|
*/
|
|
- nace = 4 + state->users->n + state->groups->n;
|
|
|
|
|
|
+ if (!state->users->n && !state->groups->n)
|
|
|
|
+ nace = 3;
|
|
|
|
+ else /* Note we also include a MASK ACE in this case: */
|
|
|
|
+ nace = 4 + state->users->n + state->groups->n;
|
|
pacl = posix_acl_alloc(nace, GFP_KERNEL);
|
|
pacl = posix_acl_alloc(nace, GFP_KERNEL);
|
|
if (!pacl)
|
|
if (!pacl)
|
|
return ERR_PTR(-ENOMEM);
|
|
return ERR_PTR(-ENOMEM);
|
|
@@ -586,9 +589,11 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags)
|
|
add_to_mask(state, &state->groups->aces[i].perms);
|
|
add_to_mask(state, &state->groups->aces[i].perms);
|
|
}
|
|
}
|
|
|
|
|
|
- pace++;
|
|
|
|
- pace->e_tag = ACL_MASK;
|
|
|
|
- low_mode_from_nfs4(state->mask.allow, &pace->e_perm, flags);
|
|
|
|
|
|
+ if (!state->users->n && !state->groups->n) {
|
|
|
|
+ pace++;
|
|
|
|
+ pace->e_tag = ACL_MASK;
|
|
|
|
+ low_mode_from_nfs4(state->mask.allow, &pace->e_perm, flags);
|
|
|
|
+ }
|
|
|
|
|
|
pace++;
|
|
pace++;
|
|
pace->e_tag = ACL_OTHER;
|
|
pace->e_tag = ACL_OTHER;
|