@@ -52,82 +52,6 @@ static inline int is_known_namespace(const char *name)
52
52
return true;
53
53
}
54
54
55
- static int can_set_system_xattr (struct inode * inode , const char * name ,
56
- const void * value , size_t size )
57
- {
58
- #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
59
- struct posix_acl * acl ;
60
- int err ;
61
-
62
- if (!inode_owner_or_capable (inode ))
63
- return - EPERM ;
64
-
65
- /*
66
- * POSIX_ACL_XATTR_ACCESS is tied to i_mode
67
- */
68
- if (strcmp (name , POSIX_ACL_XATTR_ACCESS ) == 0 ) {
69
- acl = posix_acl_from_xattr (& init_user_ns , value , size );
70
- if (IS_ERR (acl ))
71
- return PTR_ERR (acl );
72
- if (acl ) {
73
- err = posix_acl_equiv_mode (acl , & inode -> i_mode );
74
- posix_acl_release (acl );
75
- if (err < 0 )
76
- return err ;
77
- mark_inode_dirty (inode );
78
- }
79
- /*
80
- * We're changing the ACL. Get rid of the cached one
81
- */
82
- forget_cached_acl (inode , ACL_TYPE_ACCESS );
83
-
84
- return 0 ;
85
- } else if (strcmp (name , POSIX_ACL_XATTR_DEFAULT ) == 0 ) {
86
- acl = posix_acl_from_xattr (& init_user_ns , value , size );
87
- if (IS_ERR (acl ))
88
- return PTR_ERR (acl );
89
- posix_acl_release (acl );
90
-
91
- /*
92
- * We're changing the default ACL. Get rid of the cached one
93
- */
94
- forget_cached_acl (inode , ACL_TYPE_DEFAULT );
95
-
96
- return 0 ;
97
- }
98
- #endif /* CONFIG_HFSPLUS_FS_POSIX_ACL */
99
- return - EOPNOTSUPP ;
100
- }
101
-
102
- static int can_set_xattr (struct inode * inode , const char * name ,
103
- const void * value , size_t value_len )
104
- {
105
- if (!strncmp (name , XATTR_SYSTEM_PREFIX , XATTR_SYSTEM_PREFIX_LEN ))
106
- return can_set_system_xattr (inode , name , value , value_len );
107
-
108
- if (!strncmp (name , XATTR_MAC_OSX_PREFIX , XATTR_MAC_OSX_PREFIX_LEN )) {
109
- /*
110
- * This makes sure that we aren't trying to set an
111
- * attribute in a different namespace by prefixing it
112
- * with "osx."
113
- */
114
- if (is_known_namespace (name + XATTR_MAC_OSX_PREFIX_LEN ))
115
- return - EOPNOTSUPP ;
116
-
117
- return 0 ;
118
- }
119
-
120
- /*
121
- * Don't allow setting an attribute in an unknown namespace.
122
- */
123
- if (strncmp (name , XATTR_TRUSTED_PREFIX , XATTR_TRUSTED_PREFIX_LEN ) &&
124
- strncmp (name , XATTR_SECURITY_PREFIX , XATTR_SECURITY_PREFIX_LEN ) &&
125
- strncmp (name , XATTR_USER_PREFIX , XATTR_USER_PREFIX_LEN ))
126
- return - EOPNOTSUPP ;
127
-
128
- return 0 ;
129
- }
130
-
131
55
static void hfsplus_init_header_node (struct inode * attr_file ,
132
56
u32 clump_size ,
133
57
char * buf , u16 node_size )
@@ -350,10 +274,6 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
350
274
HFSPLUS_IS_RSRC (inode ))
351
275
return - EOPNOTSUPP ;
352
276
353
- err = can_set_xattr (inode , name , value , size );
354
- if (err )
355
- return err ;
356
-
357
277
if (strncmp (name , XATTR_MAC_OSX_PREFIX ,
358
278
XATTR_MAC_OSX_PREFIX_LEN ) == 0 )
359
279
name += XATTR_MAC_OSX_PREFIX_LEN ;
@@ -841,10 +761,6 @@ int hfsplus_removexattr(struct dentry *dentry, const char *name)
841
761
if (!HFSPLUS_SB (inode -> i_sb )-> attr_tree )
842
762
return - EOPNOTSUPP ;
843
763
844
- err = can_set_xattr (inode , name , NULL , 0 );
845
- if (err )
846
- return err ;
847
-
848
764
if (strncmp (name , XATTR_MAC_OSX_PREFIX ,
849
765
XATTR_MAC_OSX_PREFIX_LEN ) == 0 )
850
766
name += XATTR_MAC_OSX_PREFIX_LEN ;
@@ -941,6 +857,9 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
941
857
if (len > HFSPLUS_ATTR_MAX_STRLEN )
942
858
return - EOPNOTSUPP ;
943
859
860
+ if (is_known_namespace (name ))
861
+ return - EOPNOTSUPP ;
862
+
944
863
strcpy (xattr_name , XATTR_MAC_OSX_PREFIX );
945
864
strcpy (xattr_name + XATTR_MAC_OSX_PREFIX_LEN , name );
946
865
0 commit comments