The patch titled knfsd: nfsd4: fix handling of directories without default ACLs has been added to the -mm tree. Its filename is knfsd-nfsd4-fix-handling-of-directories-without-default-acls.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: knfsd: nfsd4: fix handling of directories without default ACLs From: J. Bruce Fields <bfields@xxxxxxxxxxxxxx> When setting an ACL that lacks inheritable ACEs on a directory, we should set a default ACL of zero length, not a default ACL with all bits denied. Signed-off-by: "J. Bruce Fields" <bfields@xxxxxxxxxxxxxx> Signed-off-by: Neil Brown <neilb@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/nfsd/nfs4acl.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletion(-) diff -puN fs/nfsd/nfs4acl.c~knfsd-nfsd4-fix-handling-of-directories-without-default-acls fs/nfsd/nfs4acl.c --- a/fs/nfsd/nfs4acl.c~knfsd-nfsd4-fix-handling-of-directories-without-default-acls +++ a/fs/nfsd/nfs4acl.c @@ -416,6 +416,7 @@ struct posix_ace_state_array { * calculated so far: */ struct posix_acl_state { + int empty; struct posix_ace_state owner; struct posix_ace_state group; struct posix_ace_state other; @@ -431,6 +432,7 @@ init_state(struct posix_acl_state *state int alloc; memset(state, 0, sizeof(struct posix_acl_state)); + state->empty = 1; /* * In the worst case, each individual acl could be for a distinct * named user or group, but we don't no which, so we allocate @@ -498,6 +500,20 @@ posix_state_to_acl(struct posix_acl_stat int nace; int i, error = 0; + /* + * ACLs with no ACEs are treated differently in the inheritable + * and effective cases: when there are no inheritable ACEs, we + * set a zero-length default posix acl: + */ + if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) { + pacl = posix_acl_alloc(0, GFP_KERNEL); + return pacl ? pacl : ERR_PTR(-ENOMEM); + } + /* + * When there are no effective ACEs, the following will end + * up setting a 3-element effective posix ACL with all + * permissions zero. + */ nace = 4 + state->users->n + state->groups->n; pacl = posix_acl_alloc(nace, GFP_KERNEL); if (!pacl) @@ -613,6 +629,8 @@ static void process_one_v4_ace(struct po u32 mask = ace->access_mask; int i; + state->empty = 0; + switch (ace2type(ace)) { case ACL_USER_OBJ: if (ace->type == NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE) { @@ -717,7 +735,8 @@ int nfs4_acl_nfsv4_to_posix(struct nfs4_ ret = PTR_ERR(*pacl); goto out_dstate; } - *dpacl = posix_state_to_acl(&default_acl_state, flags); + *dpacl = posix_state_to_acl(&default_acl_state, + flags | NFS4_ACL_TYPE_DEFAULT); if (IS_ERR(*dpacl)) { ret = PTR_ERR(*dpacl); posix_acl_release(*pacl); _ Patches currently in -mm which might be from bfields@xxxxxxxxxxxxxx are auth_gss-unregister-gss_domain-when-unloading-module.patch knfsd-nfsd4-fix-non-terminated-string.patch knfsd-nfsd4-relax-checking-of-acl-inheritance-bits.patch knfsd-nfsd4-simplify-nfsv4-posix-translation.patch knfsd-nfsd4-represent-nfsv4-acl-with-array-instead-of-linked-list.patch knfsd-nfsd4-fix-memory-leak-on-kmalloc-failure-in-savemem.patch knfsd-nfsd4-fix-error-return-on-unsupported-acl.patch knfsd-nfsd4-acls-dont-return-explicit-mask.patch knfsd-nfsd4-acls-avoid-unnecessary-denies.patch knfsd-nfsd4-fix-handling-of-directories-without-default-acls.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html