[PATCH] remove ext2 xattr permission checks
authorakpm@osdl.org <akpm@osdl.org>
Tue, 10 Jan 2006 04:51:58 +0000 (20:51 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 10 Jan 2006 16:01:30 +0000 (08:01 -0800)
\r)

From: Christoph Hellwig <hch@lst.de>

remove checks now in the VFS

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/ext2/xattr.c
fs/ext2/xattr_trusted.c
fs/ext2/xattr_user.c

index f7a3b5fee274595afbfde2e06efafbb5a94073b0..a2ca3107d475c855f549886853f62141376e5a6d 100644 (file)
@@ -389,10 +389,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
        ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld",
                  name_index, name, value, (long)value_len);
 
-       if (IS_RDONLY(inode))
-               return -EROFS;
-       if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-               return -EPERM;
        if (value == NULL)
                value_len = 0;
        if (name == NULL)
index 52b30ee6a25f31003fe3ad96c5ab087e3f27805d..2c072bfea23ba9a5f55049ab410b62fc529badd5 100644 (file)
@@ -38,8 +38,6 @@ ext2_xattr_trusted_get(struct inode *inode, const char *name,
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name,
                              buffer, size);
 }
@@ -50,8 +48,6 @@ ext2_xattr_trusted_set(struct inode *inode, const char *name,
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name,
                              value, size, flags);
 }
index 0c03ea131a948da241849d9bb82953f4b4e9cabd..f383e7c3a7b5bd18b8ca0bd43026c12ed689ce41 100644 (file)
@@ -35,16 +35,10 @@ static int
 ext2_xattr_user_get(struct inode *inode, const char *name,
                    void *buffer, size_t size)
 {
-       int error;
-
        if (strcmp(name, "") == 0)
                return -EINVAL;
        if (!test_opt(inode->i_sb, XATTR_USER))
                return -EOPNOTSUPP;
-       error = permission(inode, MAY_READ, NULL);
-       if (error)
-               return error;
-
        return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size);
 }
 
@@ -52,18 +46,10 @@ static int
 ext2_xattr_user_set(struct inode *inode, const char *name,
                    const void *value, size_t size, int flags)
 {
-       int error;
-
        if (strcmp(name, "") == 0)
                return -EINVAL;
        if (!test_opt(inode->i_sb, XATTR_USER))
                return -EOPNOTSUPP;
-       if ( !S_ISREG(inode->i_mode) &&
-           (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
-               return -EPERM;
-       error = permission(inode, MAY_WRITE, NULL);
-       if (error)
-               return error;
 
        return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name,
                              value, size, flags);