summaryrefslogtreecommitdiffstats
path: root/fs/squashfs/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/squashfs/xattr.c')
-rw-r--r--fs/squashfs/xattr.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c
index e5e0ddf5b143..4ae1e4ffd200 100644
--- a/fs/squashfs/xattr.c
+++ b/fs/squashfs/xattr.c
@@ -68,8 +68,8 @@ ssize_t squashfs_listxattr(struct dentry *d, char *buffer,
68 name_size = le16_to_cpu(entry.size); 68 name_size = le16_to_cpu(entry.size);
69 handler = squashfs_xattr_handler(le16_to_cpu(entry.type)); 69 handler = squashfs_xattr_handler(le16_to_cpu(entry.type));
70 if (handler) 70 if (handler)
71 prefix_size = handler->list(d, buffer, rest, NULL, 71 prefix_size = handler->list(handler, d, buffer, rest,
72 name_size, handler->flags); 72 NULL, name_size);
73 if (prefix_size) { 73 if (prefix_size) {
74 if (buffer) { 74 if (buffer) {
75 if (prefix_size + name_size + 1 > rest) { 75 if (prefix_size + name_size + 1 > rest) {
@@ -215,16 +215,18 @@ failed:
215/* 215/*
216 * User namespace support 216 * User namespace support
217 */ 217 */
218static size_t squashfs_user_list(struct dentry *d, char *list, size_t list_size, 218static size_t squashfs_user_list(const struct xattr_handler *handler,
219 const char *name, size_t name_len, int type) 219 struct dentry *d, char *list, size_t list_size,
220 const char *name, size_t name_len)
220{ 221{
221 if (list && XATTR_USER_PREFIX_LEN <= list_size) 222 if (list && XATTR_USER_PREFIX_LEN <= list_size)
222 memcpy(list, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 223 memcpy(list, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
223 return XATTR_USER_PREFIX_LEN; 224 return XATTR_USER_PREFIX_LEN;
224} 225}
225 226
226static int squashfs_user_get(struct dentry *d, const char *name, void *buffer, 227static int squashfs_user_get(const struct xattr_handler *handler,
227 size_t size, int type) 228 struct dentry *d, const char *name, void *buffer,
229 size_t size)
228{ 230{
229 if (name[0] == '\0') 231 if (name[0] == '\0')
230 return -EINVAL; 232 return -EINVAL;
@@ -242,8 +244,10 @@ static const struct xattr_handler squashfs_xattr_user_handler = {
242/* 244/*
243 * Trusted namespace support 245 * Trusted namespace support
244 */ 246 */
245static size_t squashfs_trusted_list(struct dentry *d, char *list, 247static size_t squashfs_trusted_list(const struct xattr_handler *handler,
246 size_t list_size, const char *name, size_t name_len, int type) 248 struct dentry *d, char *list,
249 size_t list_size, const char *name,
250 size_t name_len)
247{ 251{
248 if (!capable(CAP_SYS_ADMIN)) 252 if (!capable(CAP_SYS_ADMIN))
249 return 0; 253 return 0;
@@ -253,8 +257,9 @@ static size_t squashfs_trusted_list(struct dentry *d, char *list,
253 return XATTR_TRUSTED_PREFIX_LEN; 257 return XATTR_TRUSTED_PREFIX_LEN;
254} 258}
255 259
256static int squashfs_trusted_get(struct dentry *d, const char *name, 260static int squashfs_trusted_get(const struct xattr_handler *handler,
257 void *buffer, size_t size, int type) 261 struct dentry *d, const char *name,
262 void *buffer, size_t size)
258{ 263{
259 if (name[0] == '\0') 264 if (name[0] == '\0')
260 return -EINVAL; 265 return -EINVAL;
@@ -272,16 +277,19 @@ static const struct xattr_handler squashfs_xattr_trusted_handler = {
272/* 277/*
273 * Security namespace support 278 * Security namespace support
274 */ 279 */
275static size_t squashfs_security_list(struct dentry *d, char *list, 280static size_t squashfs_security_list(const struct xattr_handler *handler,
276 size_t list_size, const char *name, size_t name_len, int type) 281 struct dentry *d, char *list,
282 size_t list_size, const char *name,
283 size_t name_len)
277{ 284{
278 if (list && XATTR_SECURITY_PREFIX_LEN <= list_size) 285 if (list && XATTR_SECURITY_PREFIX_LEN <= list_size)
279 memcpy(list, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN); 286 memcpy(list, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN);
280 return XATTR_SECURITY_PREFIX_LEN; 287 return XATTR_SECURITY_PREFIX_LEN;
281} 288}
282 289
283static int squashfs_security_get(struct dentry *d, const char *name, 290static int squashfs_security_get(const struct xattr_handler *handler,
284 void *buffer, size_t size, int type) 291 struct dentry *d, const char *name,
292 void *buffer, size_t size)
285{ 293{
286 if (name[0] == '\0') 294 if (name[0] == '\0')
287 return -EINVAL; 295 return -EINVAL;