Commit 44a0033f6d5f3e7e2fc37d7b44a1d105c70d4682
Committed by
Linus Torvalds
1 parent
e0ad7b073e
Exists in
master
and in
7 other branches
[PATCH] remove jfs xattr permission checks
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>
Showing 1 changed file with 9 additions and 42 deletions Side-by-side Diff
fs/jfs/xattr.c
... | ... | @@ -758,36 +758,23 @@ |
758 | 758 | static int can_set_xattr(struct inode *inode, const char *name, |
759 | 759 | const void *value, size_t value_len) |
760 | 760 | { |
761 | - if (IS_RDONLY(inode)) | |
762 | - return -EROFS; | |
763 | - | |
764 | - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | |
765 | - return -EPERM; | |
766 | - | |
767 | - if(strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) == 0) | |
768 | - /* | |
769 | - * "system.*" | |
770 | - */ | |
761 | + if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) | |
771 | 762 | return can_set_system_xattr(inode, name, value, value_len); |
772 | 763 | |
773 | - if(strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) | |
774 | - return (capable(CAP_SYS_ADMIN) ? 0 : -EPERM); | |
775 | - | |
776 | -#ifdef CONFIG_JFS_SECURITY | |
777 | - if (strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) | |
778 | - == 0) | |
779 | - return 0; /* Leave it to the security module */ | |
780 | -#endif | |
781 | - | |
782 | - if((strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) != 0) && | |
783 | - (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) != 0)) | |
764 | + /* | |
765 | + * Don't allow setting an attribute in an unknown namespace. | |
766 | + */ | |
767 | + if (strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) && | |
768 | + strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) && | |
769 | + strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && | |
770 | + strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN)) | |
784 | 771 | return -EOPNOTSUPP; |
785 | 772 | |
786 | 773 | if (!S_ISREG(inode->i_mode) && |
787 | 774 | (!S_ISDIR(inode->i_mode) || inode->i_mode &S_ISVTX)) |
788 | 775 | return -EPERM; |
789 | 776 | |
790 | - return permission(inode, MAY_WRITE, NULL); | |
777 | + return 0; | |
791 | 778 | } |
792 | 779 | |
793 | 780 | int __jfs_setxattr(tid_t tid, struct inode *inode, const char *name, |
... | ... | @@ -957,22 +944,6 @@ |
957 | 944 | return rc; |
958 | 945 | } |
959 | 946 | |
960 | -static int can_get_xattr(struct inode *inode, const char *name) | |
961 | -{ | |
962 | -#ifdef CONFIG_JFS_SECURITY | |
963 | - if(strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) | |
964 | - return 0; | |
965 | -#endif | |
966 | - | |
967 | - if(strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) | |
968 | - return (capable(CAP_SYS_ADMIN) ? 0 : -EPERM); | |
969 | - | |
970 | - if(strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) == 0) | |
971 | - return 0; | |
972 | - | |
973 | - return permission(inode, MAY_READ, NULL); | |
974 | -} | |
975 | - | |
976 | 947 | ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, |
977 | 948 | size_t buf_size) |
978 | 949 | { |
979 | 950 | |
... | ... | @@ -983,11 +954,7 @@ |
983 | 954 | ssize_t size; |
984 | 955 | int namelen = strlen(name); |
985 | 956 | char *os2name = NULL; |
986 | - int rc; | |
987 | 957 | char *value; |
988 | - | |
989 | - if ((rc = can_get_xattr(inode, name))) | |
990 | - return rc; | |
991 | 958 | |
992 | 959 | if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { |
993 | 960 | os2name = kmalloc(namelen - XATTR_OS2_PREFIX_LEN + 1, |