From: Andreas Gruenbacher Date: Wed, 17 Feb 2016 05:45:50 +0000 (+1100) Subject: xfs: Validate the length of on-disk ACLs X-Git-Tag: v4.5.0-rc1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22b8a8604ce660de1afbfab9cbab9ebfd7198950;p=thirdparty%2Fxfsprogs-dev.git xfs: Validate the length of on-disk ACLs 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 Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index 7eae0a5cf..f89b6e0fc 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"