diff options
| author | akpm@osdl.org <akpm@osdl.org> | 2006-01-09 23:51:58 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:01:30 -0500 |
| commit | 267fd05791aafea3786494365a5d13d7923ef526 (patch) | |
| tree | 01f46843a0095dfb80fd7686e27b94045d2a0ff9 | |
| parent | 44a0033f6d5f3e7e2fc37d7b44a1d105c70d4682 (diff) | |
[PATCH] remove ext2 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/ext2/xattr.c | 4 | ||||
| -rw-r--r-- | fs/ext2/xattr_trusted.c | 4 | ||||
| -rw-r--r-- | fs/ext2/xattr_user.c | 14 |
3 files changed, 0 insertions, 22 deletions
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index f7a3b5fee274..a2ca3107d475 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c | |||
| @@ -389,10 +389,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name, | |||
| 389 | ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld", | 389 | ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld", |
| 390 | name_index, name, value, (long)value_len); | 390 | name_index, name, value, (long)value_len); |
| 391 | 391 | ||
| 392 | if (IS_RDONLY(inode)) | ||
| 393 | return -EROFS; | ||
| 394 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | ||
| 395 | return -EPERM; | ||
| 396 | if (value == NULL) | 392 | if (value == NULL) |
| 397 | value_len = 0; | 393 | value_len = 0; |
| 398 | if (name == NULL) | 394 | if (name == NULL) |
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c index 52b30ee6a25f..2c072bfea23b 100644 --- a/fs/ext2/xattr_trusted.c +++ b/fs/ext2/xattr_trusted.c | |||
| @@ -38,8 +38,6 @@ ext2_xattr_trusted_get(struct inode *inode, const char *name, | |||
| 38 | { | 38 | { |
| 39 | if (strcmp(name, "") == 0) | 39 | if (strcmp(name, "") == 0) |
| 40 | return -EINVAL; | 40 | return -EINVAL; |
| 41 | if (!capable(CAP_SYS_ADMIN)) | ||
| 42 | return -EPERM; | ||
| 43 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name, | 41 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name, |
| 44 | buffer, size); | 42 | buffer, size); |
| 45 | } | 43 | } |
| @@ -50,8 +48,6 @@ ext2_xattr_trusted_set(struct inode *inode, const char *name, | |||
| 50 | { | 48 | { |
| 51 | if (strcmp(name, "") == 0) | 49 | if (strcmp(name, "") == 0) |
| 52 | return -EINVAL; | 50 | return -EINVAL; |
| 53 | if (!capable(CAP_SYS_ADMIN)) | ||
| 54 | return -EPERM; | ||
| 55 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name, | 51 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name, |
| 56 | value, size, flags); | 52 | value, size, flags); |
| 57 | } | 53 | } |
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c index 0c03ea131a94..f383e7c3a7b5 100644 --- a/fs/ext2/xattr_user.c +++ b/fs/ext2/xattr_user.c | |||
| @@ -35,16 +35,10 @@ static int | |||
| 35 | ext2_xattr_user_get(struct inode *inode, const char *name, | 35 | ext2_xattr_user_get(struct inode *inode, const char *name, |
| 36 | void *buffer, size_t size) | 36 | void *buffer, size_t size) |
| 37 | { | 37 | { |
| 38 | int error; | ||
| 39 | |||
| 40 | if (strcmp(name, "") == 0) | 38 | if (strcmp(name, "") == 0) |
| 41 | return -EINVAL; | 39 | return -EINVAL; |
| 42 | if (!test_opt(inode->i_sb, XATTR_USER)) | 40 | if (!test_opt(inode->i_sb, XATTR_USER)) |
| 43 | return -EOPNOTSUPP; | 41 | return -EOPNOTSUPP; |
| 44 | error = permission(inode, MAY_READ, NULL); | ||
| 45 | if (error) | ||
| 46 | return error; | ||
| 47 | |||
| 48 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size); | 42 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size); |
| 49 | } | 43 | } |
| 50 | 44 | ||
| @@ -52,18 +46,10 @@ static int | |||
| 52 | ext2_xattr_user_set(struct inode *inode, const char *name, | 46 | ext2_xattr_user_set(struct inode *inode, const char *name, |
| 53 | const void *value, size_t size, int flags) | 47 | const void *value, size_t size, int flags) |
| 54 | { | 48 | { |
| 55 | int error; | ||
| 56 | |||
| 57 | if (strcmp(name, "") == 0) | 49 | if (strcmp(name, "") == 0) |
| 58 | return -EINVAL; | 50 | return -EINVAL; |
| 59 | if (!test_opt(inode->i_sb, XATTR_USER)) | 51 | if (!test_opt(inode->i_sb, XATTR_USER)) |
| 60 | return -EOPNOTSUPP; | 52 | return -EOPNOTSUPP; |
| 61 | if ( !S_ISREG(inode->i_mode) && | ||
| 62 | (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) | ||
| 63 | return -EPERM; | ||
| 64 | error = permission(inode, MAY_WRITE, NULL); | ||
| 65 | if (error) | ||
| 66 | return error; | ||
| 67 | 53 | ||
| 68 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name, | 54 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name, |
| 69 | value, size, flags); | 55 | value, size, flags); |
