Commit c37ef806 authored by akpm@osdl.org's avatar akpm@osdl.org Committed by Linus Torvalds

[PATCH] remove ext3 xattr permission checks

)

From: Christoph Hellwig <hch@lst.de>

remove checks now in the VFS
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 267fd057
...@@ -946,10 +946,6 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, ...@@ -946,10 +946,6 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
}; };
int error; int error;
if (IS_RDONLY(inode))
return -EROFS;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
if (!name) if (!name)
return -EINVAL; return -EINVAL;
if (strlen(name) > 255) if (strlen(name) > 255)
......
...@@ -39,8 +39,6 @@ ext3_xattr_trusted_get(struct inode *inode, const char *name, ...@@ -39,8 +39,6 @@ ext3_xattr_trusted_get(struct inode *inode, const char *name,
{ {
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name,
buffer, size); buffer, size);
} }
...@@ -51,8 +49,6 @@ ext3_xattr_trusted_set(struct inode *inode, const char *name, ...@@ -51,8 +49,6 @@ ext3_xattr_trusted_set(struct inode *inode, const char *name,
{ {
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name, return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name,
value, size, flags); value, size, flags);
} }
......
...@@ -37,16 +37,10 @@ static int ...@@ -37,16 +37,10 @@ static int
ext3_xattr_user_get(struct inode *inode, const char *name, ext3_xattr_user_get(struct inode *inode, const char *name,
void *buffer, size_t size) void *buffer, size_t size)
{ {
int error;
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!test_opt(inode->i_sb, XATTR_USER)) if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP; return -EOPNOTSUPP;
error = permission(inode, MAY_READ, NULL);
if (error)
return error;
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size); return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size);
} }
...@@ -54,19 +48,10 @@ static int ...@@ -54,19 +48,10 @@ static int
ext3_xattr_user_set(struct inode *inode, const char *name, ext3_xattr_user_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags) const void *value, size_t size, int flags)
{ {
int error;
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!test_opt(inode->i_sb, XATTR_USER)) if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP; 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 ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name, return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name,
value, size, flags); value, size, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment