|
@@ -37,16 +37,19 @@
|
|
|
|
|
|
STATIC struct posix_acl *
|
|
STATIC struct posix_acl *
|
|
xfs_acl_from_disk(
|
|
xfs_acl_from_disk(
|
|
- struct xfs_acl *aclp,
|
|
|
|
- int max_entries)
|
|
|
|
|
|
+ const struct xfs_acl *aclp,
|
|
|
|
+ int len,
|
|
|
|
+ int max_entries)
|
|
{
|
|
{
|
|
struct posix_acl_entry *acl_e;
|
|
struct posix_acl_entry *acl_e;
|
|
struct posix_acl *acl;
|
|
struct posix_acl *acl;
|
|
- struct xfs_acl_entry *ace;
|
|
|
|
|
|
+ const struct xfs_acl_entry *ace;
|
|
unsigned int count, i;
|
|
unsigned int count, i;
|
|
|
|
|
|
|
|
+ if (len < sizeof(*aclp))
|
|
|
|
+ return ERR_PTR(-EFSCORRUPTED);
|
|
count = be32_to_cpu(aclp->acl_cnt);
|
|
count = be32_to_cpu(aclp->acl_cnt);
|
|
- if (count > max_entries)
|
|
|
|
|
|
+ if (count > max_entries || XFS_ACL_SIZE(count) != len)
|
|
return ERR_PTR(-EFSCORRUPTED);
|
|
return ERR_PTR(-EFSCORRUPTED);
|
|
|
|
|
|
acl = posix_acl_alloc(count, GFP_KERNEL);
|
|
acl = posix_acl_alloc(count, GFP_KERNEL);
|
|
@@ -163,7 +166,7 @@ xfs_get_acl(struct inode *inode, int type)
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
- acl = xfs_acl_from_disk(xfs_acl, XFS_ACL_MAX_ENTRIES(ip->i_mount));
|
|
|
|
|
|
+ acl = xfs_acl_from_disk(xfs_acl, len, XFS_ACL_MAX_ENTRIES(ip->i_mount));
|
|
if (IS_ERR(acl))
|
|
if (IS_ERR(acl))
|
|
goto out;
|
|
goto out;
|
|
|
|
|