]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/btrfs/xattr.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / fs / btrfs / xattr.c
index 698fdd2c739c9286e549c290983ed1f08138ef39..a5776531dc2bacdbbc9ab2dc22d9e5361a1bf2f9 100644 (file)
@@ -316,6 +316,15 @@ ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
 int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
                   size_t size, int flags)
 {
+       struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root;
+
+       /*
+        * The permission on security.* and system.* is not checked
+        * in permission().
+        */
+       if (btrfs_root_readonly(root))
+               return -EROFS;
+
        /*
         * If this is a request for a synthetic attribute in the system.*
         * namespace use the generic infrastructure to resolve a handler
@@ -336,6 +345,15 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
 
 int btrfs_removexattr(struct dentry *dentry, const char *name)
 {
+       struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root;
+
+       /*
+        * The permission on security.* and system.* is not checked
+        * in permission().
+        */
+       if (btrfs_root_readonly(root))
+               return -EROFS;
+
        /*
         * If this is a request for a synthetic attribute in the system.*
         * namespace use the generic infrastructure to resolve a handler