Merge branch 'cleanups' of git://repo.or.cz/linux-2.6/btrfs-unstable into inode_numbers
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / btrfs / acl.c
index de34bfad9ec3cab33f35ead4f31d9605f48af66c..f66fc99597331383890ac4847329faf6a494ddb0 100644 (file)
@@ -178,16 +178,18 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
 
        if (value) {
                acl = posix_acl_from_xattr(value, size);
-               if (acl == NULL) {
-                       value = NULL;
-                       size = 0;
-               } else if (IS_ERR(acl)) {
+               if (IS_ERR(acl))
                        return PTR_ERR(acl);
+
+               if (acl) {
+                       ret = posix_acl_valid(acl);
+                       if (ret)
+                               goto out;
                }
        }
 
        ret = btrfs_set_acl(NULL, dentry->d_inode, acl, type);
-
+out:
        posix_acl_release(acl);
 
        return ret;
@@ -286,7 +288,7 @@ int btrfs_acl_chmod(struct inode *inode)
                return 0;
 
        acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl) || !acl)
+       if (IS_ERR_OR_NULL(acl))
                return PTR_ERR(acl);
 
        clone = posix_acl_clone(acl, GFP_KERNEL);