diff options
| -rw-r--r-- | fs/nfsd/nfs4acl.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index 6f3f392d48af..b6f46013dddf 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c | |||
| @@ -402,8 +402,10 @@ sort_pacl(struct posix_acl *pacl) | |||
| 402 | * by uid/gid. */ | 402 | * by uid/gid. */ |
| 403 | int i, j; | 403 | int i, j; |
| 404 | 404 | ||
| 405 | if (pacl->a_count <= 4) | 405 | /* no users or groups */ |
| 406 | return; /* no users or groups */ | 406 | if (!pacl || pacl->a_count <= 4) |
| 407 | return; | ||
| 408 | |||
| 407 | i = 1; | 409 | i = 1; |
| 408 | while (pacl->a_entries[i].e_tag == ACL_USER) | 410 | while (pacl->a_entries[i].e_tag == ACL_USER) |
| 409 | i++; | 411 | i++; |
| @@ -530,13 +532,12 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags) | |||
| 530 | 532 | ||
| 531 | /* | 533 | /* |
| 532 | * ACLs with no ACEs are treated differently in the inheritable | 534 | * ACLs with no ACEs are treated differently in the inheritable |
| 533 | * and effective cases: when there are no inheritable ACEs, we | 535 | * and effective cases: when there are no inheritable ACEs, |
| 534 | * set a zero-length default posix acl: | 536 | * calls ->set_acl with a NULL ACL structure. |
| 535 | */ | 537 | */ |
| 536 | if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) { | 538 | if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) |
| 537 | pacl = posix_acl_alloc(0, GFP_KERNEL); | 539 | return NULL; |
| 538 | return pacl ? pacl : ERR_PTR(-ENOMEM); | 540 | |
| 539 | } | ||
| 540 | /* | 541 | /* |
| 541 | * When there are no effective ACEs, the following will end | 542 | * When there are no effective ACEs, the following will end |
| 542 | * up setting a 3-element effective posix ACL with all | 543 | * up setting a 3-element effective posix ACL with all |
