]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/xattr.c
mm/page_idle.c: fix oops because end_pfn is larger than max_pfn
[mirror_ubuntu-bionic-kernel.git] / fs / xattr.c
index 61cd28ba25f364df5af103277924befb6d4a39a0..aa5b60168234ab67617bac2b9c65da99312e2e7a 100644 (file)
@@ -203,6 +203,7 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name,
 
        return error;
 }
+EXPORT_SYMBOL_GPL(__vfs_setxattr_noperm);
 
 
 int
@@ -297,6 +298,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,
        *xattr_value = value;
        return error;
 }
+EXPORT_SYMBOL_GPL(vfs_getxattr_alloc);
 
 ssize_t
 __vfs_getxattr(struct dentry *dentry, struct inode *inode, const char *name,
@@ -380,6 +382,33 @@ __vfs_removexattr(struct dentry *dentry, const char *name)
 }
 EXPORT_SYMBOL(__vfs_removexattr);
 
+/**
+ *  __vfs_removexattr_noperm - perform removexattr operation without
+ *  performing permission checks.
+ *
+ *  @dentry - object to perform setxattr on
+ *  @name - xattr name to set
+ *
+ *  returns the result of the internal setxattr or setsecurity operations.
+ *
+ *  This function requires the caller to lock the inode's i_mutex before it
+ *  is executed. It also assumes that the caller will make the appropriate
+ *  permission checks.
+ */
+int
+__vfs_removexattr_noperm(struct dentry *dentry, const char *name)
+{
+       int error;
+
+       error =__vfs_removexattr(dentry, name);
+       if (!error) {
+               fsnotify_xattr(dentry);
+               evm_inode_post_removexattr(dentry, name);
+       }
+       return error;
+}
+EXPORT_SYMBOL_GPL(__vfs_removexattr_noperm);
+
 int
 vfs_removexattr(struct dentry *dentry, const char *name)
 {
@@ -395,12 +424,7 @@ vfs_removexattr(struct dentry *dentry, const char *name)
        if (error)
                goto out;
 
-       error = __vfs_removexattr(dentry, name);
-
-       if (!error) {
-               fsnotify_xattr(dentry);
-               evm_inode_post_removexattr(dentry, name);
-       }
+       error = __vfs_removexattr_noperm(dentry, name);
 
 out:
        inode_unlock(inode);
@@ -541,7 +565,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
        if (error > 0) {
                if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
                    (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
-                       posix_acl_fix_xattr_to_user(kvalue, size);
+                       posix_acl_fix_xattr_to_user(kvalue, error);
                if (size && copy_to_user(value, kvalue, error))
                        error = -EFAULT;
        } else if (error == -ERANGE && size >= XATTR_SIZE_MAX) {