clk: rockchip: rk3368: remove the flag ROCKCHIP_PLL_SYNC_RATE for NPLL
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_acl.c
index 4b641676f258d7ac76c4462a562cc4406b89d882..c5101a3295d83253599861370736535b44310963 100644 (file)
 
 STATIC struct posix_acl *
 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 *acl;
-       struct xfs_acl_entry *ace;
+       const struct xfs_acl_entry *ace;
        unsigned int count, i;
 
+       if (len < sizeof(*aclp))
+               return ERR_PTR(-EFSCORRUPTED);
        count = be32_to_cpu(aclp->acl_cnt);
-       if (count > max_entries)
+       if (count > max_entries || XFS_ACL_SIZE(count) != len)
                return ERR_PTR(-EFSCORRUPTED);
 
        acl = posix_acl_alloc(count, GFP_KERNEL);
@@ -160,10 +163,11 @@ xfs_get_acl(struct inode *inode, int type)
                 */
                if (error == -ENOATTR)
                        goto out_update_cache;
+               acl = ERR_PTR(error);
                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))
                goto out;
 
@@ -284,16 +288,11 @@ xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
                return error;
 
        if (type == ACL_TYPE_ACCESS) {
-               umode_t mode = inode->i_mode;
-               error = posix_acl_equiv_mode(acl, &mode);
-
-               if (error <= 0) {
-                       acl = NULL;
-
-                       if (error < 0)
-                               return error;
-               }
+               umode_t mode;
 
+               error = posix_acl_update_mode(inode, &mode, &acl);
+               if (error)
+                       return error;
                error = xfs_set_mode(inode, mode);
                if (error)
                        return error;