nfsd4: fix corruption on setting an ACL.
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 15 May 2014 01:57:26 +0000 (21:57 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 15 May 2014 19:36:04 +0000 (15:36 -0400)
As of 06f9cc12caa862f5bc86ebdb4f77568a4bef0167 "nfsd4: don't create
unnecessary mask acl", any non-trivial ACL will be left with an
unitialized entry, and a trivial ACL may write one entry beyond what's
allocated.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4acl.c

index b6f46013dddf26bc5306349a26160aa5c9450eb7..f66c66b9f18285a4084114679d0e1d3e555a253c 100644 (file)
@@ -590,7 +590,7 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags)
                add_to_mask(state, &state->groups->aces[i].perms);
        }
 
-       if (!state->users->n && !state->groups->n) {
+       if (state->users->n || state->groups->n) {
                pace++;
                pace->e_tag = ACL_MASK;
                low_mode_from_nfs4(state->mask.allow, &pace->e_perm, flags);