Don't panic when we read an empty ACL from ZFS. Apparently this may happen

with filesystems created under MacOS X ZFS port.  This is kind of filesystem
corruption (we don't allow for setting empty ACLs), so make acl_get_file(3)
and related syscalls fail with EINVAL in that case.  In theory, we could
return empty ACL to userland, but I'm afraid this would break some code.

MFC after:	3 days
This commit is contained in:
Edward Tomasz Napierala 2010-11-30 21:04:05 +00:00
parent b56b04b800
commit de2a57325d

View File

@ -105,7 +105,10 @@ acl_from_aces(struct acl *aclp, const ace_t *aces, int nentries)
struct acl_entry *entry;
const ace_t *ace;
KASSERT(nentries >= 1, ("empty ZFS ACL"));
if (nentries < 1) {
printf("acl_from_aces: empty ZFS ACL; returning EINVAL.\n");
return (EINVAL);
}
if (nentries > ACL_MAX_ENTRIES) {
/*