Commit b98932cb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] remove reiserfs xattr permission checks

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 c37ef806
...@@ -497,12 +497,6 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, ...@@ -497,12 +497,6 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
struct iattr newattrs; struct iattr newattrs;
__u32 xahash = 0; __u32 xahash = 0;
if (IS_RDONLY(inode))
return -EROFS;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
if (get_inode_sd_version(inode) == STAT_DATA_V1) if (get_inode_sd_version(inode) == STAT_DATA_V1)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -758,9 +752,6 @@ int reiserfs_xattr_del(struct inode *inode, const char *name) ...@@ -758,9 +752,6 @@ int reiserfs_xattr_del(struct inode *inode, const char *name)
struct dentry *dir; struct dentry *dir;
int err; int err;
if (IS_RDONLY(inode))
return -EROFS;
dir = open_xa_dir(inode, FL_READONLY); dir = open_xa_dir(inode, FL_READONLY);
if (IS_ERR(dir)) { if (IS_ERR(dir)) {
err = PTR_ERR(dir); err = PTR_ERR(dir);
...@@ -984,12 +975,6 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, ...@@ -984,12 +975,6 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (IS_RDONLY(dentry->d_inode))
return -EROFS;
if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode))
return -EROFS;
reiserfs_write_lock_xattr_i(dentry->d_inode); reiserfs_write_lock_xattr_i(dentry->d_inode);
lock = !has_xattr_dir(dentry->d_inode); lock = !has_xattr_dir(dentry->d_inode);
if (lock) if (lock)
...@@ -1019,12 +1004,6 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name) ...@@ -1019,12 +1004,6 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name)
get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (IS_RDONLY(dentry->d_inode))
return -EROFS;
if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode))
return -EPERM;
reiserfs_write_lock_xattr_i(dentry->d_inode); reiserfs_write_lock_xattr_i(dentry->d_inode);
reiserfs_read_lock_xattrs(dentry->d_sb); reiserfs_read_lock_xattrs(dentry->d_sb);
......
...@@ -16,18 +16,10 @@ static int ...@@ -16,18 +16,10 @@ static int
user_get(struct inode *inode, const char *name, void *buffer, size_t size) user_get(struct inode *inode, const char *name, void *buffer, size_t size)
{ {
int error;
if (strlen(name) < sizeof(XATTR_USER_PREFIX)) if (strlen(name) < sizeof(XATTR_USER_PREFIX))
return -EINVAL; return -EINVAL;
if (!reiserfs_xattrs_user(inode->i_sb)) if (!reiserfs_xattrs_user(inode->i_sb))
return -EOPNOTSUPP; return -EOPNOTSUPP;
error = reiserfs_permission_locked(inode, MAY_READ, NULL);
if (error)
return error;
return reiserfs_xattr_get(inode, name, buffer, size); return reiserfs_xattr_get(inode, name, buffer, size);
} }
...@@ -36,43 +28,21 @@ user_set(struct inode *inode, const char *name, const void *buffer, ...@@ -36,43 +28,21 @@ user_set(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags) size_t size, int flags)
{ {
int error;
if (strlen(name) < sizeof(XATTR_USER_PREFIX)) if (strlen(name) < sizeof(XATTR_USER_PREFIX))
return -EINVAL; return -EINVAL;
if (!reiserfs_xattrs_user(inode->i_sb)) if (!reiserfs_xattrs_user(inode->i_sb))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!S_ISREG(inode->i_mode) &&
(!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
return -EPERM;
error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
if (error)
return error;
return reiserfs_xattr_set(inode, name, buffer, size, flags); return reiserfs_xattr_set(inode, name, buffer, size, flags);
} }
static int user_del(struct inode *inode, const char *name) static int user_del(struct inode *inode, const char *name)
{ {
int error;
if (strlen(name) < sizeof(XATTR_USER_PREFIX)) if (strlen(name) < sizeof(XATTR_USER_PREFIX))
return -EINVAL; return -EINVAL;
if (!reiserfs_xattrs_user(inode->i_sb)) if (!reiserfs_xattrs_user(inode->i_sb))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!S_ISREG(inode->i_mode) &&
(!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
return -EPERM;
error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
if (error)
return error;
return 0; return 0;
} }
......
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