aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakpm@osdl.org <akpm@osdl.org>2006-01-09 23:51:58 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:30 -0500
commitc37ef806a3e1c0bca65fd03b7590d56d19625da4 (patch)
tree858caa56d151f28a98765e993a503c2481ec440c
parent267fd05791aafea3786494365a5d13d7923ef526 (diff)
[PATCH] remove ext3 xattr permission checks
) 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>
-rw-r--r--fs/ext3/xattr.c4
-rw-r--r--fs/ext3/xattr_trusted.c4
-rw-r--r--fs/ext3/xattr_user.c15
3 files changed, 0 insertions, 23 deletions
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index 238199d82ce5..e8d60bf6b7df 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -946,10 +946,6 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
946 }; 946 };
947 int error; 947 int error;
948 948
949 if (IS_RDONLY(inode))
950 return -EROFS;
951 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
952 return -EPERM;
953 if (!name) 949 if (!name)
954 return -EINVAL; 950 return -EINVAL;
955 if (strlen(name) > 255) 951 if (strlen(name) > 255)
diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c
index f68bfd1cf519..7c693c94f14d 100644
--- a/fs/ext3/xattr_trusted.c
+++ b/fs/ext3/xattr_trusted.c
@@ -39,8 +39,6 @@ ext3_xattr_trusted_get(struct inode *inode, const char *name,
39{ 39{
40 if (strcmp(name, "") == 0) 40 if (strcmp(name, "") == 0)
41 return -EINVAL; 41 return -EINVAL;
42 if (!capable(CAP_SYS_ADMIN))
43 return -EPERM;
44 return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, 42 return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name,
45 buffer, size); 43 buffer, size);
46} 44}
@@ -51,8 +49,6 @@ ext3_xattr_trusted_set(struct inode *inode, const char *name,
51{ 49{
52 if (strcmp(name, "") == 0) 50 if (strcmp(name, "") == 0)
53 return -EINVAL; 51 return -EINVAL;
54 if (!capable(CAP_SYS_ADMIN))
55 return -EPERM;
56 return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name, 52 return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name,
57 value, size, flags); 53 value, size, flags);
58} 54}
diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c
index e907cae7a07c..a85a0a17c4fd 100644
--- a/fs/ext3/xattr_user.c
+++ b/fs/ext3/xattr_user.c
@@ -37,16 +37,10 @@ static int
37ext3_xattr_user_get(struct inode *inode, const char *name, 37ext3_xattr_user_get(struct inode *inode, const char *name,
38 void *buffer, size_t size) 38 void *buffer, size_t size)
39{ 39{
40 int error;
41
42 if (strcmp(name, "") == 0) 40 if (strcmp(name, "") == 0)
43 return -EINVAL; 41 return -EINVAL;
44 if (!test_opt(inode->i_sb, XATTR_USER)) 42 if (!test_opt(inode->i_sb, XATTR_USER))
45 return -EOPNOTSUPP; 43 return -EOPNOTSUPP;
46 error = permission(inode, MAY_READ, NULL);
47 if (error)
48 return error;
49
50 return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size); 44 return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size);
51} 45}
52 46
@@ -54,19 +48,10 @@ static int
54ext3_xattr_user_set(struct inode *inode, const char *name, 48ext3_xattr_user_set(struct inode *inode, const char *name,
55 const void *value, size_t size, int flags) 49 const void *value, size_t size, int flags)
56{ 50{
57 int error;
58
59 if (strcmp(name, "") == 0) 51 if (strcmp(name, "") == 0)
60 return -EINVAL; 52 return -EINVAL;
61 if (!test_opt(inode->i_sb, XATTR_USER)) 53 if (!test_opt(inode->i_sb, XATTR_USER))
62 return -EOPNOTSUPP; 54 return -EOPNOTSUPP;
63 if ( !S_ISREG(inode->i_mode) &&
64 (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
65 return -EPERM;
66 error = permission(inode, MAY_WRITE, NULL);
67 if (error)
68 return error;
69
70 return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name, 55 return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name,
71 value, size, flags); 56 value, size, flags);
72} 57}