aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4acl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index d190e33d0ec2..6f3f392d48af 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -542,7 +542,10 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags)
542 * up setting a 3-element effective posix ACL with all 542 * up setting a 3-element effective posix ACL with all
543 * permissions zero. 543 * permissions zero.
544 */ 544 */
545 nace = 4 + state->users->n + state->groups->n; 545 if (!state->users->n && !state->groups->n)
546 nace = 3;
547 else /* Note we also include a MASK ACE in this case: */
548 nace = 4 + state->users->n + state->groups->n;
546 pacl = posix_acl_alloc(nace, GFP_KERNEL); 549 pacl = posix_acl_alloc(nace, GFP_KERNEL);
547 if (!pacl) 550 if (!pacl)
548 return ERR_PTR(-ENOMEM); 551 return ERR_PTR(-ENOMEM);
@@ -586,9 +589,11 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags)
586 add_to_mask(state, &state->groups->aces[i].perms); 589 add_to_mask(state, &state->groups->aces[i].perms);
587 } 590 }
588 591
589 pace++; 592 if (!state->users->n && !state->groups->n) {
590 pace->e_tag = ACL_MASK; 593 pace++;
591 low_mode_from_nfs4(state->mask.allow, &pace->e_perm, flags); 594 pace->e_tag = ACL_MASK;
595 low_mode_from_nfs4(state->mask.allow, &pace->e_perm, flags);
596 }
592 597
593 pace++; 598 pace++;
594 pace->e_tag = ACL_OTHER; 599 pace->e_tag = ACL_OTHER;