summaryrefslogtreecommitdiffstats
path: root/sys/cddl/compat/opensolaris/kern
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2010-11-30 21:04:05 +0000
committertrasz <trasz@FreeBSD.org>2010-11-30 21:04:05 +0000
commitcb2672a1ca9f2f4c40256707b7aaacd4638ab028 (patch)
treedf7735ff1679895cb88603ddabaca95347792656 /sys/cddl/compat/opensolaris/kern
parent768c79cd77507ac85776ce9d84567c35df4ca8a2 (diff)
downloadFreeBSD-src-cb2672a1ca9f2f4c40256707b7aaacd4638ab028.zip
FreeBSD-src-cb2672a1ca9f2f4c40256707b7aaacd4638ab028.tar.gz
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
Diffstat (limited to 'sys/cddl/compat/opensolaris/kern')
-rw-r--r--sys/cddl/compat/opensolaris/kern/opensolaris_acl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c b/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c
index a458f6d..c10b101 100644
--- a/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c
+++ b/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c
@@ -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) {
/*
OpenPOWER on IntegriCloud