Skip to content

Commit

Permalink
[PATCH] remove ext3 xattr permission checks
Browse files Browse the repository at this point in the history
)

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>
  • Loading branch information
akpm@osdl.org authored and Linus Torvalds committed Jan 10, 2006
1 parent 267fd05 commit c37ef80
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
4 changes: 0 additions & 4 deletions fs/ext3/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,10 +946,6 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
};
int error;

if (IS_RDONLY(inode))
return -EROFS;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
if (!name)
return -EINVAL;
if (strlen(name) > 255)
Expand Down
4 changes: 0 additions & 4 deletions fs/ext3/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ ext3_xattr_trusted_get(struct inode *inode, const char *name,
{
if (strcmp(name, "") == 0)
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name,
buffer, size);
}
Expand All @@ -51,8 +49,6 @@ ext3_xattr_trusted_set(struct inode *inode, const char *name,
{
if (strcmp(name, "") == 0)
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name,
value, size, flags);
}
Expand Down
15 changes: 0 additions & 15 deletions fs/ext3/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,21 @@ static int
ext3_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 ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size);
}

static int
ext3_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 ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name,
value, size, flags);
}
Expand Down

0 comments on commit c37ef80

Please sign in to comment.