irqchip: tegra: Add Tegra210 support
[firefly-linux-kernel-4.4.55.git] / fs / posix_acl.c
index 9e363e41dacc8c2ebc007661a598c01e84da45c9..3a48bb789c9f3e4eb227214f72798b90c52af5dc 100644 (file)
@@ -246,6 +246,12 @@ posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p)
        umode_t mode = 0;
        int not_equiv = 0;
 
+       /*
+        * A null ACL can always be presented as mode bits.
+        */
+       if (!acl)
+               return 0;
+
        FOREACH_ACL_ENTRY(pa, acl, pe) {
                switch (pa->e_tag) {
                        case ACL_USER_OBJ:
@@ -558,13 +564,11 @@ posix_acl_create(struct inode *dir, umode_t *mode,
 
        *acl = posix_acl_clone(p, GFP_NOFS);
        if (!*acl)
-               return -ENOMEM;
+               goto no_mem;
 
        ret = posix_acl_create_masq(*acl, mode);
-       if (ret < 0) {
-               posix_acl_release(*acl);
-               return -ENOMEM;
-       }
+       if (ret < 0)
+               goto no_mem_clone;
 
        if (ret == 0) {
                posix_acl_release(*acl);
@@ -585,6 +589,12 @@ no_acl:
        *default_acl = NULL;
        *acl = NULL;
        return 0;
+
+no_mem_clone:
+       posix_acl_release(*acl);
+no_mem:
+       posix_acl_release(p);
+       return -ENOMEM;
 }
 EXPORT_SYMBOL_GPL(posix_acl_create);
 
@@ -766,7 +776,7 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
 
        if (!IS_POSIXACL(dentry->d_inode))
                return -EOPNOTSUPP;
-       if (S_ISLNK(dentry->d_inode->i_mode))
+       if (d_is_symlink(dentry))
                return -EOPNOTSUPP;
 
        acl = get_acl(dentry->d_inode, type);
@@ -826,7 +836,7 @@ posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size,
 
        if (!IS_POSIXACL(dentry->d_inode))
                return -EOPNOTSUPP;
-       if (S_ISLNK(dentry->d_inode->i_mode))
+       if (d_is_symlink(dentry))
                return -EOPNOTSUPP;
 
        if (type == ACL_TYPE_ACCESS)