summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2010-06-12 11:27:10 +0000
committermm <mm@FreeBSD.org>2010-06-12 11:27:10 +0000
commitddf29dd30c0895aa99718954a81d35dbdf4f99a4 (patch)
treeac526db113f1454015e75d3148efe4692418f657 /sys/cddl
parent9a68899bb4cfc5a2d960e92ca42afcf891dcf57d (diff)
downloadFreeBSD-src-ddf29dd30c0895aa99718954a81d35dbdf4f99a4.zip
FreeBSD-src-ddf29dd30c0895aa99718954a81d35dbdf4f99a4.tar.gz
Fix panic in zfs_getsecattr
OpenSolaris onnv-revision: 10295:f7a18a1e9610 Obtained from: OpenSolaris (Bug ID 6870564) Approved by: pjd, delphij (mentor) MFC after: 3 days
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
index 9825d83..01007d7 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
@@ -1984,8 +1984,6 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr)
if (mask & VSA_ACE) {
size_t aclsz;
- zfs_acl_node_t *aclnode = list_head(&aclp->z_acl);
-
aclsz = count * sizeof (ace_t) +
sizeof (ace_object_t) * largeace;
@@ -1996,8 +1994,17 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr)
zfs_copy_fuid_2_ace(zp->z_zfsvfs, aclp, cr,
vsecp->vsa_aclentp, !(mask & VSA_ACE_ALLTYPES));
else {
- bcopy(aclnode->z_acldata, vsecp->vsa_aclentp,
- count * sizeof (ace_t));
+ zfs_acl_node_t *aclnode;
+ void *start = vsecp->vsa_aclentp;
+
+ for (aclnode = list_head(&aclp->z_acl); aclnode;
+ aclnode = list_next(&aclp->z_acl, aclnode)) {
+ bcopy(aclnode->z_acldata, start,
+ aclnode->z_size);
+ start = (caddr_t)start + aclnode->z_size;
+ }
+ ASSERT((caddr_t)start - (caddr_t)vsecp->vsa_aclentp ==
+ aclp->z_acl_bytes);
}
}
if (mask & VSA_ACE_ACLFLAGS) {
OpenPOWER on IntegriCloud