[PATCH 14/14] xfs: Validate the length of on-disk ACLs
Dave Chinner
david at fromorbit.com
Mon Feb 15 00:18:25 CST 2016
From: Andreas Gruenbacher <agruenba at redhat.com>
Source kernel commit 86a21c79745ca97676cbd47f8608839382cc0448
In xfs_acl_from_disk, instead of trusting that xfs_acl.acl_cnt is correct,
make sure that the length of the attributes is correct as well. Also, turn
the aclp parameter into a const pointer.
Signed-off-by: Andreas Gruenbacher <agruenba at redhat.com>
Reviewed-by: Dave Chinner <dchinner at redhat.com>
Signed-off-by: Dave Chinner <david at fromorbit.com>
---
libxfs/xfs_format.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h
index 7eae0a5..f89b6e0 100644
--- a/libxfs/xfs_format.h
+++ b/libxfs/xfs_format.h
@@ -1502,9 +1502,13 @@ struct xfs_acl {
sizeof(struct xfs_acl_entry) \
: 25)
-#define XFS_ACL_MAX_SIZE(mp) \
+#define XFS_ACL_SIZE(cnt) \
(sizeof(struct xfs_acl) + \
- sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp)))
+ sizeof(struct xfs_acl_entry) * cnt)
+
+#define XFS_ACL_MAX_SIZE(mp) \
+ XFS_ACL_SIZE(XFS_ACL_MAX_ENTRIES((mp)))
+
/* On-disk XFS extended attribute names */
#define SGI_ACL_FILE "SGI_ACL_FILE"
--
2.5.0
More information about the xfs
mailing list