]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/xattr.c
bcm2835-v4l2: Fix buffer overflow problem
[mirror_ubuntu-zesty-kernel.git] / fs / xattr.c
index 2d13b4e62faec1cd0e3ff8d5966e767821867a2c..d6314a206e8dade55081b4c73128b662ec81ae4e 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/vmalloc.h>
 #include <linux/posix_acl_xattr.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static const char *
 strcmp_prefix(const char *a, const char *a_prefix)
@@ -202,6 +202,7 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name,
 
        return error;
 }
+EXPORT_SYMBOL_GPL(__vfs_setxattr_noperm);
 
 
 int
@@ -296,6 +297,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,
@@ -379,6 +381,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)
 {
@@ -394,12 +423,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);
@@ -530,7 +554,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
                        size = XATTR_SIZE_MAX;
                kvalue = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
                if (!kvalue) {
-                       kvalue = vmalloc(size);
+                       kvalue = vzalloc(size);
                        if (!kvalue)
                                return -ENOMEM;
                }